思路
只能挂载在根分区,根由谁来挂载?
mount命令详解
分区, 创建、调整、查看文件系统,挂载文件系统、显示挂载信息、验证挂载
写时复制和原处读写
同步IO和异步IO的区别
在创建文件系统之后,如果要使用此文件系统,应该将设备/分区关联至根设备的某个目录之下
根由内核管理,是一切的起始
根的由来
1)刚开机时,post加电自检
2)自检后,装载bootloader
3)bootloader装载用户 所选择的操作系统内核(系统启动装载的第一个程序)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
CentOS 7 :
/etc/grub2
.cfg 中定义了
{
load_video
##加载显卡
linux16
/boot/vmlinuz-3
.10.0-514.26.2.el7.x86_64 root=UUID=07151862-c2b9-45dc-bf7a-af8d2a6fa6c1 rocrashkernel=auto rhgb quiet net.ifnames=0 LANG=en_US.UTF-8
##加载的内核文件
root=UUID=07151862-c2b9-45dc-bf7a-af8d2a6fa6c1
## 装载内核时,需要指明根所在的分区
initrd16
/boot/initramfs-3
.10.0-514.26.2.el7.x86_64.img
## 根文件系统的驱动
}
CentOS 6 :
/boot/grub/grub
.conf中定义了
title CentOS 6 (2.6.32-696.el6.i686)
root (hd0,0)
kernel
/vmlinuz-2
.6.32-696.el6.i686 ro root=
/dev/mapper/myvg-lv_root
rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=myvg
/lv_swap
KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet rd_NO_DM rd_LVM_LV=myvg
/lv_root
rhgb quiet
initrd
/initramfs-2
.6.32-696.el6.i686.img
根的位置:人为的通过grub配置文件,传递给内核,内核才能加载根
|
4)内核(通用目的的管理程序,不会完成特定目的的操作)初始化后,取得系统的控制权
/内核初始化后---> 装载根 --> 启动根文件系统上的Init程序(完成特定目的操作)
为了完成特定目的的操作,应该启动应用程序,存储在外部存储设备上的应用程序
1、装载某个磁盘分区,根文件系统所在的分区,满足FHS标准的分区
1)根分区:启动时用到的分区
2)启动后,通过根分区某个路径下的mount命令关联其他分区至根,保证任何文件都处于根下
3) 根必须提供启动所依赖的程序和库文件,且只能在根文件系统中(bin,sbin,lib,lib64)
2、启动用户空间的第一个程序(/sbin/init)
init程序代替内核,启动程序:
1、所有程序都是init的子进程,都是init仿照自己的样子捏出来的, init 程序fork自身而来
2、任何子进程也能有子进程
3、init的类型:
pstree查看:CentOS5:init, CentOS6: initstart, CentOS7: systemd
如何通过mount命令关联其他操作系统
挂载
1) 关联的目录非空时,挂载后,此目录中的文件暂时隐藏
2) 挂载后,内核会将挂载信息记录在/proc/mounts文件中
3)将两个非根文件系统关联需要一个中间层 或者 为了保证一切文件都属于根,则必须先将一个文件系统关联至根,然后才能将另一个文件系统关联至此文件系统,已经关联至根的文件系统.
卸载
1) 卸载一个被非根设备关联的文件系统时,应该先卸载关联的所有设备,才能解除与根的关联关系
2) 卸载时,如果将要被卸载的设备,正在被某个进程访问,是不能解除关联关系.(例如cd进程)
分区,创建、查看、调整文件系统 ,挂载,显示挂载情况,挂载鸡,配置开机自动挂载,卸载
挂载
mount命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
[root@localhost ~]
# type mount
mount
is
/bin/mount
[root@localhost ~]
# man mount
mount
[OPTIONS...] device_partition MOUNT_POINT
##将设备关联至目录,目录作为设备的访问入口
DEVICE_PARTITION:
1)设备文件,
/dev/sda1
2)全局唯一标示,-U UUID。推荐:UUID:设备文件名改变时,UUID唯一不变
3) 卷标, -L LABEL
4) 内核支持的伪文件系统,proc,sysfs,devtmpfs,configfs
5) 目录,--bind DIR
MOUNT_POINT:
DIR:建议为空目录,非空目录时,挂载后原目录中的文件暂时会隐藏
临时挂载点:mnt,media
OPTIONS:
-t vfstype
## 指明挂载设备的文件系统类型
-r
readonly
,
## 挂载后不能向挂载的分区中写入数据
-w
read
and write,
## 挂载后能向挂载的分区中写入数据
-a auto,
## 挂载所有定义在fstab文件中且设备挂载选项支持自动挂载的设备
-
v
,verbose
## 显示挂载过程
-n
## 此次挂载不更新/etc/mtab文件。mount命令读取/etc/mtab文件。 挂载时,内核将信息记录于/proc/mounts文件中,然后同步至/etc/mtab文件中
--bind
## 将目录绑定至另一个目录,后面的目录作为前面的目录的访问入口
-L LABEL
## 基于LABEL挂载
-U UUID
## 基于UUID挂载
-o OPTIONS:
async
## 异步IO
sync
## 同步IO
atime
## 记录文件和访问时间
noatime
## 不记录文件的访问时间
diratime
## 目录的访问时间
nodiratime
## 不记录目录的访问时间
auto
## 自动挂载,默认。定义在fstab文件中,和此默认属性便能实现mount -a
noauto
## 不自动挂载
exec
/noexec
## 挂载的设备上的文件是否能运行为一个进程
dev
/nodev
## 新挂载的设备上有设备文件,此设备文件能否作为设备的访问入口
suid
/nosuid
## 挂载的设备上的文件有suid权限时,能否运行为一个进程
remount
## 不卸载的情况下,完成重新挂载。用于不卸载修改挂载特性。
ro
/rw
## 只读挂载,可写挂载
user
/nouser
## 是否允许普通用户挂载此已经挂载后的设备,默认普通用户不能挂载设备
acl
## 启用系统acl功能
CentOS 5,6:默认不启用acl
CentOS 7 : 默认启用acl
default
CentOS 默认挂载选项:
rw, suid, dev,
exec
, auto, nouser, async, and relatime.
|
##将设备关联至目录,目录作为设备的访问入口
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
1、查看所有分区
[root@localhost ~]
# fdisk -l /dev/sd[a-z]
2、修改分区
[root@localhost ~]
# fdisk /dev/sdb
1) 分区新分区
Command (m
for
help): n
2) 分配空间
Last cylinder, +cylinders or +size{K,M,G} (1576-2610, default 2610): +100M
3)查看分区
Command (m
for
help): p
4)保存并退出
Command (m
for
help): w
3、查看内核识别的分区表
[root@localhost ~]
# cat /proc/partitions
[root@localhost ~]
# ls /dev/sdb*
4、让内核重读分区表
[root@localhost ~]
# partx -a /dev/sdb
[root@localhost ~]
# partx -a /dev/sdb
5、格式化、创建新的文件系统
[root@localhost ~]
# mkfs.ext4 /dev/sdb8
块大小=4096 (log=2)
131122 blocks (5.00%) reserved
for
the super user
Superblock backups stored on blocks
6、将设备
/dev/sdb8
关联至
/mnt
目录
[root@localhost ~]
# mount /dev/sda3 /mnt
|
##查看挂载信息
1
2
3
4
5
6
7
8
|
##内核追踪到的已挂载的所有设备
[root@localhost ~]
# cat /proc/mounts
##从/proc/mounts文件同步而来的数据
[root@localhost ~]
# cat /etc/mtab
##显示/etc/mtab中的挂载信息
[root@localhost ~]
# mount
|
1
2
3
4
5
6
7
8
9
|
+++++++++++++++++++++++++++++++++
设备 挂载点 文件系统类型 访问权限(rw)
实现资源分割与管理
proc -->
/proc
sysfs -->
/sys
devpts -->
/dev/pts
tmpfs -->
/dev/shm
+++++++++++++++++++++++++++++++++
|
##挂载验证
1
2
3
|
##ext系列文件系统挂载后有lost+found目录
[root@localhost ~]
# ls /mnt
lost+found
|
##解除关联关系
1
2
3
4
|
1、目录
[root@localhost ~]
# umount /mnt
2、设备
[root@localhost ~]
# umount /dev/sdb8
|
##卸载时,如果出现device busy时,有进程正在访问此设备
1
2
3
4
5
6
7
|
##查看正在访问指定文件系统的进程
fuser -
v
MOUNT_POINT
lsof
-
v
MOUNT_POINT
bash
:
bash
内建命令在访问
##杀死正在访问此文件系统的进程
fuser -km MOUNT_POINT (root)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
##制造环境
[root@localhost mnt]
# cd /mnt
##查看进程
[root@localhost mnt]
# fuser -v /mnt
用户 进程号 权限 命令
/mnt
: root 2142 ..c..
bash
##终止进程
[root@localhost mnt]
# fuser -km /mnt
/mnt
: 2142c
Connection closed by foreign host.
Disconnected from remote host(192.168.1.103:22) at 10:46:17.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
|
使用选项注释
PARTITIONS:
1、-U UUID
1
2
3
4
5
6
7
8
9
10
11
12
|
1
、获取UUID
[root@localhost ~]# blkid /dev/sda3
/dev/sda3: UUID=
"8e02ad4b-818b-405e-96b1-2f8aedf9136b"
TYPE=
"ext4"
2
、以UUID挂载:
[root@localhost ~]# mount -U 8e02ad4b-818b-405e-96b1-2f8aedf9136b /mnt
3
、验证挂载
[root@localhost ~]# ls /mnt
lost+found
[root@localhost ~]# mount
/dev/sda3 on /mnt type ext4 (rw)
|
2、-L LABEL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
1、修改卷标为MYDATA
[root@localhost ~]
# tune2fs -L 'MYDATA' /dev/sda3
tune2fs 1.41.12 (17-May-2010)
2、查看LABEL
[root@localhost ~]
# blkid /dev/sda3
/dev/sda3
: UUID=
"8e02ad4b-818b-405e-96b1-2f8aedf9136b"
TYPE=
"ext4"
LABEL=
"MYDATA"
3、以LABEL挂载
[root@localhost ~]
# mount -L 'MYDATA' /mnt
4、验证挂载
[root@localhost ~]
# ls /mnt
lost+found
[root@localhost ~]
# mount
/dev/sda3
on
/mnt
type
ext4 (rw)
|
3、伪文件系统挂载
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
1、查看伪文件系统
[root@localhost ~]
# mount
proc on
/proc
type
proc (rw)
devpts on
/dev/pts
type
devpts (rw,gid=5,mode=620)
tmpfs on
/dev/shm
type
tmpfs (rw)
sysfs on
/sys
type
sysfs (rw)
2、查看伪文件系统生成的文件
[root@localhost ~]
# ls /sys
block bus class dev devices firmware fs hypervisor kernel module power
3、卸载伪文件系统
[root@localhost ~]
# umount sysfs
[root@localhost ~]
# umount /sys
4、查看
[root@localhost ~]
# umount sysfs
[root@localhost ~]
# ls /sys
[root@localhost ~]
# echo $?
0
5、挂载伪文件系统
[root@localhost ~]
# blkid sysfs ##伪文件系统,不是文件系统
[root@localhost ~]
# echo $?
2
[root@localhost ~]
# mount -t sysfs sysfs /sys
6、查看
[root@localhost ~]
# !ls
ls
/sys
block bus class dev devices firmware fs hypervisor kernel module power
|
4、目录绑定
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
##将newdir作为olddir的访问入口
mount
--bind olddir newdir
1、显示
/mnt
下的文件
[root@localhost ~]
# ls /mnt
lost+found
2、显示
/sys
下的文件
[root@localhost ~]
# ls /sys
block bus class dev devices firmware fs hypervisor kernel module power
3、绑定目录
[root@localhost ~]
# mount --bind /sys /mnt
4、显示Newdir
[root@localhost ~]
# ls /mnt
block bus class dev devices firmware fs hypervisor kernel module power
5、查看挂载信息
[root@localhost ~]
# mount
/sys
on
/mnt
type
none (rw,bind)
|
OPTIONS:
-r 只读挂载
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1、测试挂载
[root@localhost ~]
# mount /dev/sda3 /mnt
[root@localhost ~]
# ls /mnt
lost+found
2、查看挂载信息
[root@localhost ~]
# mount
/dev/sda3
on
/mnt
type
ext4 (rw)
##访问权限为读写
3、卸载后,重新挂载
[root@localhost ~]
# umount /mnt
[root@localhost ~]
# mount -r /dev/sda3 /mnt
[root@localhost ~]
# mount
/dev/sda3
on
/mnt
type
ext4 (ro)
##访问权限为只读
|
挂载时,内核将信息记录于/proc/mounts文件中,然后同步至/etc/mtab文件中
-n 此次挂载不同步信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
##以上挂载,mount命令均能显示其挂载信息
##不同步信息挂载
[root@localhost ~]
# mount -n /dev/sda3 /mnt
[root@localhost ~]
# mount
/dev/mapper/myvg-lv_root
on /
type
ext4 (rw)
proc on
/proc
type
proc (rw)
devpts on
/dev/pts
type
devpts (rw,gid=5,mode=620)
tmpfs on
/dev/shm
type
tmpfs (rw)
/dev/sda1
on
/boot
type
ext4 (rw)
/dev/mapper/myvg-lv_home
on
/home
type
ext4 (rw)
/dev/mapper/myvg-lv_usr
on
/usr
type
ext4 (rw)
/dev/mapper/myvg-lv_var
on
/var
type
ext4 (rw)
none on
/proc/sys/fs/binfmt_misc
type
binfmt_misc (rw)
sysfs on
/sys
type
sysfs (rw)
##查看内核记录在/proc/mounts文件中的信息。
[root@localhost ~]
# cat /proc/mounts | fgrep dev/sda3
/dev/sda3
/mnt
ext4 rw,relatime,barrier=1,data=ordered 0 0
|
-a 挂载所有定义在fstab文件中且设备挂载选项支持自动挂载的设备
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
1
、定义fstab
/dev/sdb1 /mydata ext4 defaults,acl
2
3
2
、创建MOUNT_POINT
install -d /mydata
2
、自动挂载
[root@localhost ~]# mount | fgrep /mydata
[root@localhost ~]# echo $?
1
[root@localhost ~]# mount -a -v
mount: UUID=5009dc18-28f5-4b32-8c7c-0ea1328ea224 already mounted on /boot
mount: /dev/mapper/myvg-lv_home already mounted on /home
mount: /dev/mapper/myvg-lv_usr already mounted on /usr
mount: /dev/mapper/myvg-lv_
var
already mounted on /
var
mount: tmpfs already mounted on /dev/shm
mount: devpts already mounted on /dev/pts
mount: sysfs already mounted on /sys
mount: proc already mounted on /proc
/dev/sdb1 on /mydata type ext4 (rw,acl)
3
、查看:
[root@localhost ~]# mount | fgrep /mydata
/dev/sdb1 on /mydata type ext4 (rw,acl)
|
-v 挂载信息
1
2
3
4
5
6
7
|
[root@localhost mnt]
# mount -v -o remount,ro,defaults /mnt
/dev/sda3
on
/mnt
type
ext4 (ro)
[root@localhost /]
# umount /mnt
[root@localhost /]
# mount -v /dev/sda3 /mnt
mount
: you didn't specify a filesystem
type
for
/dev/sda3
I will try
type
ext4
/dev/sda3
on
/mnt
type
ext4 (rw)
|
-o options:
defaults CentOS 默认挂载选项: rw, suid, dev, exec, auto, nouser, async, and relatime.
man mount中查看
1
2
3
4
5
|
[root@localhost ~]
# mount -o defaults /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (rw)
********其他默认的属性信息不会显示********
|
ext4系列的文件系统,默认async,nodiratime
CentOS7,默认acl
sync 同步IO
1
2
3
|
[root@localhost ~]
# mount -o sync /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (rw,
sync
)
|
nosuid 挂载的设备上的文件有suid权限时,不能运行为一个进程
1
2
3
4
5
|
[root@localhost ~]
# !umount
umount
/mnt
[root@localhost ~]
# mount -o nosuid /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (rw,nosuid)
|
remount 重新挂载,不卸载的情况下,完成设备重新挂载,用于修改挂载属性
1
2
3
4
5
6
7
8
|
##方法一
[root@localhost ~]
# mount -o remount,ro /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (ro)
##方法二
[root@localhost /]
# mount -o remount,diratime,defaults /dev/sda3
[root@localhost /]
# mount -o remount,diratime,defaults /mnt
|
nodev 挂载的文件系统上,有设备文件,不能使用
1
2
3
4
|
[root@localhost ~]
# umount /mnt
[root@localhost ~]
# mount -o nosuid,nodev /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (rw,nosuid,nodev)
|
noexec 挂载的文件系统上,有程序文件,不能运行为一个进程
1
2
3
|
[root@localhost ~]
# mount -o remount,ro,noexec /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (ro,noexec)
|
noauto 挂载的文件系统,不支持通过 fstab文件自动挂载
1
2
3
|
[root@localhost ~]
# mount -o remount,ro,noexec,noauto /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (ro,noexec)
|
默认属性,默认只显示rw,修改为Noauto也不会显示
user 挂载的设备能被普通用户挂载
1
2
3
|
[root@localhost ~]
# mount -o remount,ro,noexec,noauto,user /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (ro,noexec,nosuid,nodev)
|
当调整为普通用户可挂载时,自动进行,调整为其内部的设备不可用。且用户可挂载此设备属性不会显示
1
2
3
|
[root@localhost ~]
# mount -o remount,ro,noexec,noauto,user,dev /dev/sda3 /mnt
[root@localhost ~]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (ro,noexec,nosuid)
|
noatime 挂载的文件系统,不更新文件访问时间戳
atime: 每次访问文件时,更新磁盘中的文件的时间戳。写磁盘产生,IO产生
##测试默认属性
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
##默认挂载
[root@localhost ~]
# mount /dev/sda3 /mnt
[root@localhost
dir
]
# blkid /dev/sda3 ##文件系统类型为ext4
/dev/sda3
: UUID=
"8e02ad4b-818b-405e-96b1-2f8aedf9136b"
TYPE=
"ext4"
LABEL=
"MYDATA"
##测试访问
[root@localhost ~]
# cd /mnt/dir
[root@localhost ~]
# touch a
[root@localhost
dir
]
# stat a
Access: 2017-08-09 05:42:49.662993539 +0800
Modify: 2017-08-09 05:42:49.662993539 +0800
Change: 2017-08-09 05:42:49.766999113 +0800
[root@localhost
dir
]
# cat a
[root@localhost
dir
]
# date
2017年 08月 09日 星期三 05:44:05 CST
#查看访问时间戳
[root@localhost
dir
]
# stat a
Access: 2017-08-09 05:44:02.933994163 +0800
##改变
Modify: 2017-08-09 05:42:49.662993539 +0800
Change: 2017-08-09 05:42:49.766999113 +0800
|
##关闭atime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#关闭
[root@localhost /]
# mount -o defaults,remount,noatime /mnt
#查看属性
[root@localhost /]
# mount | fgrep /mnt
/dev/sda3
on
/mnt
type
ext4 (rw,noatime)
#访问文件系统下的文件
[root@localhost /]
# cd /mnt/dir
访问前
[root@localhost
dir
]
# stat a
Access: 2017-08-09 05:44:02.933994163 +0800
Modify: 2017-08-09 05:42:49.662993539 +0800
Change: 2017-08-09 05:42:49.766999113 +0800
[root@localhost
dir
]
# date
2017年 08月 09日 星期三 06:09:22 CST
访问
[root@localhost
dir
]
# cat a
访问后的时间
[root@localhost
dir
]
# stat a
Access: 2017-08-09 05:44:02.933994163 +0800
##没有变...
Modify: 2017-08-09 05:42:49.662993539 +0800
|
diratime/nodiratime 目录访问时间戳
ext默认不启用目录访问时间戳
##测试默认属性
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@localhost
dir
]
# cd ..
[root@localhost mnt]
# stat dir
Access: 2017-08-09 05:43:50.596000162 +0800
Modify: 2017-08-09 05:42:49.790996746 +0800
Change: 2017-08-09 05:42:49.790996746 +0800
[root@localhost mnt]
# cd dir
[root@localhost
dir
]
# cat a
[root@localhost
dir
]
# cd ..
[root@localhost mnt]
# !stat
stat
dir
Access: 2017-08-09 05:43:50.596000162 +0800
##不变
Modify: 2017-08-09 05:42:49.790996746 +0800
Change: 2017-08-09 05:42:49.790996746 +0800
|
##启用diratime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[root@localhost mnt]
# mount -o remount,diratime,atime /mnt
[root@localhost mnt]
# stat dir
File:
"dir"
Size: 4096 Blocks: 8 IO Block: 4096 目录
Device: 803h
/2051d
Inode: 518145 Links: 2
Access: (0755
/drwxr-xr-x
) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2017-08-09 05:43:50.596000162 +0800
Modify: 2017-08-09 05:42:49.790996746 +0800
Change: 2017-08-09 05:42:49.790996746 +0800
[root@localhost mnt]
# cd dir
[root@localhost
dir
]
# cd ..
[root@localhost mnt]
# stat dir
File:
"dir"
Size: 4096 Blocks: 8 IO Block: 4096 目录
Device: 803h
/2051d
Inode: 518145 Links: 2
Access: (0755
/drwxr-xr-x
) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2017-08-09 05:43:50.596000162 +0800
Modify: 2017-08-09 05:42:49.790996746 +0800
Change: 2017-08-09 05:42:49.790996746 +0800
|
mount命令挂载特性总结:
auto和user,无论启用或关闭均不会显示
目录diratime默认不启用。文件atime默认启用
默认为async
写时复制和原地读写
shell程序 (特殊字符的转换,词法/语法分析) ---> 提交给内核 -->内核加载把程序从磁盘加载至内存,分配CPU时针周期,内存资源的分配-->轮到程序在CPU上运行时--> CPU加载指令--> 运行指令 -->指令运行需要数据时,从内存中读取数据
同步IO和异步IO的区别
程序运行完成了,就会将内存中的数据同步至磁盘.同步的方式有"同步IO" "异步IO"