Академический Документы
Профессиональный Документы
Культура Документы
Version
...
1429/1428
.
) (Alpha
.
:
:
:
:
:
:
:
:
:
:
:
: .
.
:
1
)1940(
.
) IOCS: Input/Output Control
(System
.
.
.
)(General Motors Research Laboratories
IBM 701 Mainframe 1956
. ).(Batch Computing
: Multiprogramming
.
) . (JCL: Job Control Language
.
)( ) 1960(
.
.
) .(Multiprogramming
!.
.
) (Timesharing
.
)1970( .
). (TCP/IP
) (
.
) (UNIX
Assembly
( (Language
C .
.
).(Bell Laboratories
.
.
.
.
.
IBM
.
. )
(
IBM .
( (Intels 16-bit 8080
. Bill Gates .
Bill Gates 10
50 !.
Bill Gates IBM
Tim Paterson 8080 QDOS:
( (Quick and Dirty Operating System Microsoft
. ( (MS-DOS
1991 1700
.
:
http://www.computinghistorymuseum.org/teaching/papers/research
/history_of_operating_system_Moumina.pdf
:
Operating System Structures
,
,
.
.
, .
)(xxdewdropsxx@gmail.com
:
: (Operating System Services)2
: :
-1 ):(User Interface
,
:
,
- .-
-3 ) :(I/O Operations
.
,
, .
-5 ):(communications
. .
: ) ( shared memory
). (message passing
-6 ):(Error Detection
!
.
:
):(resource sharing
-1 ): (Resource allocation
, :
.
-2 ): (Accounting
. ) (shell
.
.
,
.
Bourne,Bash Korn C Bourne
.Again
.
:
.
) .(kernel
.
. .
, :
. .
-
.
, .
) (.
, ,
,
, .
iPhone ,Google Maps , Google Earth :
:
Operating system Concepts (Seventh Edition): Abraham Silberschatz,Peter Baer
Galvin,Greg Gagne
http://ar.wikipedia.org/wiki
http://en.wikipedia.org/wiki
http://www.opendirectorysite.info
http://en.wikipedia.org/wiki/ZUI
4
: )( System Calls
.
) ( .
,
.
, ,
) .(parameters :
.1 ) .(register
.
.2 , stack
. .
.3 ) (block ),(table
) (register
.
,
4 s)S :&U$ v [u UOm M*U&) $&U !X& o"(X% s#&("O c &("f%M
, stack
!
.1 : / / /
.2 : / /
.3 : /
.4 : / /
.5 .
) ,(API's ) system
) (kernel mode . (call
)( -open :
) . (open () >>>>>open system call
!
.
:
:
Win32 API .1
POSIX API .2 UNIX Linux Mac OS X
JAVA API .3 .
,
:
.1 ) (Portability .
:
WindowsLinux Mac .
, .2
.
)system calls
:(implementation of
) (API ) (index ,
) , (system table ). (index
):(index
)( , -open
, ,
) (system table :
,
.
: , , ,
.
: , , ,
.
: .
: .
: .
:
.
5 : oS&|{"$
6
: )(Operating Systems Structure
:
.1 ): (Monolithic
.
: .
:
.
.
.
.
.2 ): (Layered
)(
(layer 0) 0 ) (Hardware ) (layer N
, :
6 : ["X&W")Z
: .
: .
.3 ) : (Microkernel
.
).(message passing
:
)( .
.
:
.
.4 ): (Modules-based
.
:
Operating system Concepts (Seventh Edition): Abraham
Silberschatz, Peter Baer Galvin, Greg Gagne
: )(Virtual Machines7
.
.
.
.
.
.
.
.
,
.
,
. ,
) (SYSTEM GENERATION " ".
) ,(CD
" "SYSGEN
,
, :
, .
.
, .
, , .
,
,
.
:
Operating system Concepts (Seventh Edition): Abraham
Silberschatz, Peter Baer Galvin, Greg Gagne
8 : ["X(cO
:
Processes
.
.
.
process .
time-sharing.
.
: ) (code
.
) (CPU .multiplexed
.
:
Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th
edition
wiki :
http://os1h.pbwiki.com/
http://os2h.pbwiki.com/
http://os3h.pbwiki.com/
http://os2a.pbwiki.com/
)(Hend.khalid@gmail.com
:
: Process Concept9
:
) ,(CPU .
.
) (operating systems
. .
.
10
Process
) ( :
o ) (address space )
(
o ).(program code
o ).(program data
o ).(stack pointer
o )) (program counter
(.
o ) (register.
o ) (heap .
9 s#&("O
&|Xhttp://en.wikipedia.org/wiki/Process_%28computing%29 :
10 &($d
: Processes State11
,
.
:
)) (new (:
RAM
": ".
):(ready
CPU
.
):(Running
. CPU
):(waiting
:
.
):(terminated
("X& 11 &(uU
&Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :nUX
,
.
- )( :
.
- )( : )(CPU
) (CPU
) ( .
- )( : )(
.
12
:
o ) (terminated
o ) (ready
o ) (waiting
o
.
o ) :(state , , ,
.
13) &U"OX
&Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :nUX
http://en.wikipedia.org/wiki/Process_control_block
o ) :(Program Counter
.
o ) :(Registers
, )( (stack
) ,pointer ) (index registers
) (general-purpose registers
) (condition-code information
, .
o ):(CPU-scheduling information
, .
o ) :(memory-management information
) (base ) ,(limit
) (segment table ) (page table
.
o ) :(Accounting information
.
o PCB .
,
.
) (PCB ,
) (PCB .
14
):(PCB
.
) (kernel stack
.
15
: Process Scheduling
www.ice.ntnu.edu.tw/~swanky/os/chap4.htm 14
15c & !%"PX&UXOperating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :n
http://en.wikipedia.org/wiki/Scheduling
)(queue
:Scheduling Queues
.1 ) :(job queue
.2 ) :(ready queue
16
.3 ) :(device queue .
) (
http://en.wikipedia.org/wiki/Scheduling_%28computing%29
http://en.wikipedia.org/wiki/Ready_queue
(* 16W &U"OX
&Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :nUX
17
)(Scheduler
:queue scheduling
) ( job queue
)( ready queue
)(I/O queue
17
http://arstechnica.com/articles/paedia/cpu/hyperthreading.ars/4
18
:scheduler
:long-term scheduler
) real
(time system .
) (virtual memory
) (secondary storage .
.
:short-term scheduler
18
www.cs.wayne.edu/~tom/guide/os.html
.
.
:19Types Of Processes
) (CPU
).(CPU burst
) (I/O
).(I/O burst
) (ready queue
.
20
.
S 19
M&M$"d
&Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :nUX
20UQ :($ & (S) ["Xd~c * M(O & S [u&(dX
* & M)d c s (#h US( U M&(&($*
())~X cQ (c ( U "|(* {$ ( (S(X&~! &! c(& o~i&cOX.
21
)(context switching
: ) (thread .
) (CPU scheduler .
) (context PCB
) (CPU registers .
:
.1
.
) (interrupt
.2 ) (context .
.3 )
) (interrupt .
22
:
.1 )(privileged mode
.2 ) (register
.3 ) (register
.4 )(user mode
21
(X &M&$
&http://www.linfo.org/context_switch.html :nUX
22 vX&(
&http://www2.cs.uregina.ca/~hamilton/courses/330/notes/processes/processes.html :nUX
23
Operations on Processes
Process Creations24
)System Call
( )( Parent Process
) (Child Process
.
http://www.ice.ntnu.edu.tw/~swanky/os/chap4/CPU_Switch_From_Process_to_Process.png 23
()S 24 &(OPQM
&Operating System Concepts: Silbreschatz, Galvin and Gagne, 7th edition :nUX
)(
.
)( - -
) (Process Identifier .
Ps command
) (function )( fork
.
) (PID 0
)( exec
25
.
26
Process Termination
:
.1 ) :( Normal Exist .
.2 ) :( Error Exist ) Fatal
.(Error ) (compile .
.3 ) :(Fatal Error :
.
.4 ) (kill .
http://www.freebsd.org/doc/en_US.ISO8859-1/books/design-44bsd/book.html 25
" 26&(fW
&http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/processOperate.htm:nUX
27
*( [X&Uf , (u& , &U"
Operating System Concepts: Silbreschatz, Galvin &and Gagne, 7th edition :nUX
):(Independent
.
):(Cooperating
:IPC
.1 ):(Message passing
)(Kernel
.
.2 ):(Shared memory
.
:
.
.
.
.
.
:Shared-Memory Systems
) ,
28
(.
:
):(unbounded-buffer
):(bounded-buffer
29
: )(massage- passing
)(/)(:
.1 .
28(# &M$"d
&UXwww.comms.scitech.susx.ac.uk/fft/computer/ipc.pdf :n
www.1006.org/os2006/labtext07_en.doc
http://www.alhasebat.com/vb/showthread.php?t=1878
http://www.cs.unc.edu/~dewan/242/f97/notes/ipc/node9.html
deneb.cs.kent.edu/~mikhail/classes/os.s00/L05ipcs.PDF
29(# &M$"d
&UXwww.comms.scitech.susx.ac.uk/fft/computer/ipc.pdf :n
www.1006.org/os2006/labtext07_en.doc
http://www.alhasebat.com/vb/showthread.php?t=1878
http://www.cs.unc.edu/~dewan/242/f97/notes/ipc/node9.html
deneb.cs.kent.edu/~mikhail/classes/os.s00/L05ipcs.PDF
.2 .
.3 )(buffer
.1 :
:
) ( buffer
.
:
)send ( receiver_process, message
)( send() :
receiver_process :
message :
:system call
)receive (sender_process, message
)( receive :
sender_process :
message :
: ,
) (mailbox . :
(mailbox, message) Send
)receive (mailbox, message
).(queue
:
.1 )(unique identification
.2
.3
.2 :
.1 ):(blocking
,
.
.2 ):(unblocking
) (unblocking
, ) ( parallelism
.
.3 :buffering
.
: zero ) (queue
)(rendezvous
: ) (queue . n
, .
) (block send
.
: ,
.
/ .
30
) ( ,
,
.
) ( .
,
,
.
,
.
-1 .
-2 ) (.
-3 .
-4 .
-5 .
-6 ,
-7 .
-8 .
-9 .
.thread pool -10
.LWP -11
-12)( .
) (f.a.t.o.m.y@windowslive.com
) (yasamenah@hotmail.com .
: 31
) (application ,
:
-1 ) ( an executing program
, .
(Process) -2
)(mapping .
-3
:(Thread)33
) ( ) (
.
)(thread .
s)S32&U$v
("X&33 &%(
) address
. (space
thread !!
......
, ,
,
.
-1 ) (ID
-2) (program counter
-3)(register
-4)(stack
-1
, .
- 2 ) (
.
-3 .
-4 ) (SHARE CPU ) creat
.(child
34
-1
runtime -2 ) (address space )
(enivorment ) (process ID
, .
-3
-4 ) ( context switch , over head
.
-5 thread is a concurrent unit of ) .
(process execution inside a
-6 , " ".
.
:
) (register )(stack
) ) (code) (data
). (files
) (register )( . ( stack
) )(processes:35
) (1 ) ( single Threaded
)(2 )(multi Threaded
) ( multi Threaded
)(multitasking
)(time slicing
) (multiprocessor thread ).(scheduler
36
) ( multi Threaded):(single Threaded
) (1 ): ( responsiveness
) (2 ) :( resourse sharing
37c &M$"d
, ) ( threads
) address
. ( space
) (3 ) : ( economy
.
.
)(4 :
.
- :
-1 :
.
-2 :
.
:38
POSIX Pthread -1
WIN32 -2
.
Java. Pthread - 3
.
:39
(User threads) -1 :
) (Kernel
) (library function
).(hard ware
) (Kernel
(Kernel threads) -2 :
38 oS&(XP
[X(*39&Uf
) (Kernel )(function
)(system call
:
Windows XP/2000, Solaris, Linux, Mac OS X -
- ) (Kernel
) )(thread :40
- ) : (user_space thread .
- ) : (kernal )(kernal
) (user_space thread
) ( kernel .
) (1 : Many-to-one Mode
) user
(threads ), (kernel threads
)( thread
) , (library
.
s)S40&n(X
(41 &(UQ
: )( kernel
:
.Solaris Green Threads, GNU Pthreads
) One-to-one Mode(2
) (user threads
) (kernel threads ,
,
) (user threads
) ( kernel ,
.
:
) ( kernel ) (user thread
) (kernel ) .(Kernel
. Linux, windows 95,98,NT,2000,XP :
Many-to- )(3
: many Model
) user
(threads
)(kernel threads
) ( user threads
) .(kernel
) (4 )(Two-level Model
) (Similar to M:M M:M
IRIX,HP-:
(. UNIX UX and Tru64
) ( M: M) (Two-level-model ,
kernel thread ,
LWP kernel
kernel thread . user thread
42
User Level Threads vs. Kernel Level Threads
User level
thread
thread
) (Kernel
thread .
) single
(threaded user thread
other
threads
.
,
,
.
) (Cancellation:
,
,
""
,
.
:
>#include <pthread.h
;)int pthread_cancel(pthread_t thread
:45
Process-identifier
ps
process-identifier
Kill -1 process-identifier
44(X &M&$
45c &()PM
child
Kill -9 process-identifier
child
Kill process-identifier process-identifier
, .
) :( .
) : ( .
:(default) -1 .
:(user-defined)-2 .
:Synchronous Signals
46 &)d
, , ,
Synchronous
.Signals
:Asynchronous Signals
, ) ( .
, Control + c .
-1 .
-2 .
-3 .
-4 .
, Synchronous Signals
.
thread
.
Asynchronous Signal .
thread .
, APCs (Asynchronous
).procedure calls
user thread ) (function
. .
:47
ctrl+z ctrl+c
.
ctrl+z kill
pash pash kill kill :
( . (kill 9)<-- pash
:Thread pool
) (pool
.
:
-1 ). (cpu time
- 2 .
) (pool )(pool
)(pool ,
) (pool .
): (pool
-1 .
-2 ) (POOL ..
.
) (CPUs ,
.
) (pool
.
)(thread library
.
.
Lightweight process LWP
.
LWP .
LWP .
,
LWP.
:48Scheduler Activation
LWP
.
:Upcall .
Upcall handler
.
:Upcall
, .
48 &)d
:context switch and multi-threading49
:
: .
: .
) (threads :50
-1 : .
-2 : .
: word process
save every two min & spell check in one
.process
-3) (process ) (server .
-4 ) (data ) interprocess
.(communication
-5 . processes
-6 kernal thread
.
s)S49&n(X
50 & , (X & M&$*)( &U"P$
:51
-1 .
-2 ) (stack ) (register .
-3
) (address space
) (data global ).(program code
-4 ( pc
program counter ) , sp (stack pointer) , register.
51(X &M&$
:
CPU Scheduling
) (CPU
) (processes ) (CPU )(process
!
) (CPU scheduler
.
) (CPU scheduling
)(multiprogramming
) CPU-I/O
(Burst Cycle
)(CPU Scheduler
)(Preemptive Scheduling
dispatcher
)(Scheduling Criteria
)(Scheduling Algorithms
))(First-come First-served (FCFS-FIFO
))(Shortest-Job-First (SJR
) )( Round Robin (RR
)(Multilevel Queue
)(Multilevel Feedback Queue
)(Multiple-Processor Scheduling
) ( Thread Scheduling
) (k.alroumi@gmail.com
))
((
)(CPU Scheduling Mind Map
) CPU-I/O
:(Burst Cycle
) (Process
) (CPU .
) (CPU burst
) (I/O burst
) (CPU burst
) (I/O burst
) (CPU burst ) (OS
.
) (I/O bound
) (CPU burst
) (I/O burst
) (CPU bound .
)(CPU bound
) (CPU burst
) (CPU burst
) (I/O bound
) (CPU burst ) (CPU burst.
) (CPU burst
) (CPU burst
) (frequency .
-1 (I/O bound
): processes
,
) (CPU CPU bursts
-2 (CPU bound
):processes
) (CPU
CPU bursts
:
-1 ):(interactive processes
) (input )(wake up
) (avg delay 50-150ms
.
.
-2 ):(batch processes
.
) (batch processes
.
-3 ):(real-time processes
.
) (CPU ) ( idle
). (ready queue
) (short-term scheduler
) (ready queue
) (CPU.
:
-1 ):(long-term scheduler
) (processes
.
-2 ): (short-term scheduler
) (process ) CPU
(.
.
-3 ):(medium-term scheduler
.
.
) :( preemptive scheduling
.
) : ( non-preemptive scheduling
.
-1 ) (Process ) :
/ , ).( (child
-2 ) (running state ) ready
) (state: ) (time out (.
-3 ) :(.
-4 ).(Terminate
1 4 )non-
(preemptive ).(preemptive
) (non-preemptive )(CPU
) (CPU
.
) (non-preemptive
, ) : ( Timer ) (Kernel
) ( DOS
) (preemptive ) (Kernel
) (CPU .
) (Multiprocessing
.
dispatcher
, ) CPU
, (scheduler ) ,(dispatcher
) (CPU scheduler
) (ready queue ) (CPU
.
) , (Dispatcher ,
- - ) (CPU.
-1 ).( context switch
-2 .
-3 .
)(dispatcher latency
:
) (CPU
:
-1 )(CPU utilization
) (CPU
:
- = ) ( ) /
( * 100
- = ) () / +
(* 100
!
.
-2 )(Throughput
-3 )(Turnaround time
-
- )(ready queue
-
-
-4 )(Waiting time
) (ready queue
)(CPU
-5 )(Response time
(interactive) system .
( maximum CPU
) utilization ) (
Throughput
) (Waiting time
) (Response time )(Turnaround time
) ( CPU utilization (context
)Switching ) (
) (CPU
) ( Response time
). (Ready Queue
) (CPU ) (Non-preemptive
) (kernel .
.1 .
.2 .
.3 ) (performance
)(convoy effect
.
.4 ) (interactive system
(non
)preemptive scheduling
:1
:2
t0 P1,P2,P3
Gantt chart:
0-23 24-26 27-30
P1 P2 P3
: P2,P3,P1
0-2 3-5 6-30
P2 P3 P1
): Shortest-Job-First (SJR
.1 ) : (Non-preemptive
.
.2 ) :(Preemptive
.
.
:
) t( n+1 ) = w * t( n ) + (1 - w ) * T( n
:
) t(n+1
) t(n
) T(n
W 0 <= w <= 10
) ( .
: )
(starvation :
.
.1 .
.2 .
:1
:( (Non-preemptive) ) 2
:( (preemptive) ) 3
(Arrival (Burst
(Process) time) time)
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Gantt chart:
0 1-4 5-9 10-16 17-25
P1 P2 P4 P1 P3
) (time quantum
)(FCFS
) (time quantum
)(context switch
:1
:
):(Multilevel Queue
) (queue .
) (queue
) (queue ) ) (ready queues
( multilevel feedback
)
( :
.1 :
.
.2 ) : (time slice ) 5(
.
):(Multilevel Feedback Queue
) (multilevel queue
) (ready queue .
) (FIFO queues
) (
.
:
) (queue
Q0 Q0
. Q1 . Q0
Q0 Q1 Q2
) (last queue
8B:=> ?9@ 1A89: 45212
(Shortest-job-first
(Multilevel feedback )(Round-Robin )(First come first served
)scheduling
)queue
CPU
burst
CPU burst
o#&~([ &#f
(Multilevel feedback
)(Multilevel queue
)queue
8B: Multilevel Queue & Multilevel Feedback Queue?9@ 1A
&)UOm "U& Ucu& M$"d&( # OX&( X $&( f Uf&[ X(* UXi& W*(
MXud& c M*U[ u - c%&[ X o"(X%&
:;<@?>
Operating System Concepts
https://www.it.uu.se/edu/course/homepage/oskomp/vt07/lectures/scheduling_algorit
hms
http://www.personal.kent.edu/~rmuhamma/OpSystems/Myos/multQueue.htm
http://en.wikipedia.org/wiki/Multilevel_queue
http://cs.wwc.edu/~aabyan/352/Scheduling.html
http://www.cs.jhu.edu/~yairamir/cs418/os2/tsld039.htm
http://www.mines.edu/Academic/courses/math_cs/macs442/resources/S9schedul-
Part2.pdf
http://en.wikipedia.org/wiki/Multilevel_Feedback_Queue
www.student.cs.uwaterloo.ca/~cs350/S04/notes/sched.pdf
)( Multiple-Processor Scheduling
) ( one CPU
) (multiple CPUs!
(many
) CPUs .
) (homogeneous processor
) (heterogeneous processor
.1 ) :(Homogeneous ,
) ,(register )
. (motherboard .
.2 ) :(Heterogeneous .
.1 ) : (Load sharing
) cup
(schedule .
.2 ) :(Asymmetric multiprocessing
, ,
,
) (master
) ( slaves
).(master
:
.1 )(master
.2
:
.1 ) (queue
.2 ) (queue
): (threads
) (thread library
) (kernel ) , (LWP )
(LWP .
) (c :
PTHREAD_SCOPE_PROCESS
)(Deadlock
..
.
. .
.
)(Deadlock
:
-1 .
-2 .
-3 .
-4 .
)(norah_gaissi@hotmail.com
.
- -
.
:
:
-1
-2
-3
-4
!!
:
.
:
... ..
.
) (preemption ...
:
..
):(Resources
:
)( , .
.
.
-1 ) (Preemptable .
-2 ) (Non-Preemtable .
:
.
:
.
" ,
-1 : ) (
.
-2 : .
-3 : .
.
.Deadlock
**
.
()Resource-allocation graph
:
-1= },1,2,3 { 4 .
-2= },12 {3 .
.
.
.
.
**:
,1 1 2 .
2 2 .3
Deadlock. 3 3 2
:
<-2 <- 2 <- 3 <- 32
:
.
:
/1 .
/2 .
/ :
.
.
/1 :
.
/2 :
.
.
.
.
.
:
/1 /2 . /3 . /4 .
/5 . /6 .
.
/ :
.
. 3:
/1 : .
.
/2 :
.
/3:
.
***
-1 ,
, :
-
, , .
- ,
, .
- ,
,
.
-2 Constrained Allocation
:
-1 Standard Allocation
- 2 Controlled Allocation
, .
.
-3 Detect and
Recover
, ,
:
):(Resource assignment table -
- ) :(process wait table
.
* :
1968
):(Dining Philosophers
.. ..
)(http://www.doc.ic.ac.uk/~jnm/book/book_applets/Diners.html
. :
.
.
...
-
.
-
.
-
.
.
.
.
.
http://www.doc.ic.ac.uk/~jnm/book/book_applets/Diners.html
http://www.doc.ic.ac.uk/~jnm/book/book_applets/FixedDiners.html
http://courses.cs.vt.edu/csonline/OS/Lessons/Deadlock/index.ht
ml
http://en.wikipedia.org/wiki/Dining_philosophers_probl
em
http://www.cs.jhu.edu/~yairamir/cs418/os4/sld003.htm
Operating system concepts Book by Silberchatz Galvin Gagne
http://www.math-
cs.gordon.edu/courses/cs322/lectures/deadlock.html
http://www.cs.rpi.edu/academics/courses/fall04/os/c10/index.ht
ml
http://www.math-
cs.gordon.edu/courses/cs322/lectures/deadlock.html
http://www.cs.rpi.edu/academics/courses/fall04/os/c10/index.ht
ml
http://en.wikipedia.org/wiki/Deadlock
http://www.math-
cs.gordon.edu/courses/cs322/lectures/deadlock.html
http://www.cs.jhu.edu/~yairamir/cs418/os4/sld003.htm
http://www.math-
cs.gordon.edu/courses/cs322/lectures/deadlock.html
http://en.wikipedia.org/wiki/Deadlock
http://www.math-
cs.gordon.edu/courses/cs322/lectures/deadlock.html
http://www.cs.jhu.edu/~yairamir/cs418/os4/sld003.htm
http://courses.cs.vt.edu/csonline/OS/Lessons/Deadlock/index.ht
ml
:
Memory Management and Virtual
Memory
) (RAM
.
) (processes
.
52
.
)(afnan.s@gmail.com
1
en.Wikipedia.org
:
Paging
Pages
Demand Paging in Virtual Memory
) (
.
Lazy Swapper
Pager Swapper
Pager Pages .
) ( Page-fault Pager
.
55
.
) - (
55
En.wikipedia.org and www.science.unitn.it
) (Secondary Storage (Physical
)Memory .
)(
.
:
) ( bit
) .(Page Table
:
-1 ) : (valid .
-2 ) : (invalid :
. ) (.
. ) . (
) ( :
-1 ).(invalid
-2 .
) (pager
.
" "
) (Trap ) (Page-Fault Trap
.
:
) (Frame
.
) (Page-Fault
56
).(Pure Demand Paging
) (
- :
.
- :
.
- : .
- :
)(copy-on-write
,
57
.
56
Operating System Concepts by Silberschatz, Galin and Gange.
57
En.wikipedia.org
:
: )
( PCB
) (valid
) (invalid
.
:
) (
.
: ) (frame
).(free-frame
: .
:
.
: .
58
.
) - (
---
: Copy-on-Write
)( Fork
)( )(
58
Operating System Concepts by Silberschatz, Galin and Gange
)( exec .
) (COW
.
) (
:
)( .
) (
-1
) (frame ) (victim ) back
(store
.
).(basic replacement
) (
:
-1 .
-2 :
.a .
.b
.
.c
.
-3 .
-4 .
) (
)
(
.
) (modify bit or dirty bit
1
) (
) (
.
)frame-
(allocation algorithm
) (over allocation
).(page replacement algorithm
) reference
(string
) ( .
) (
-2 FIFO
) (FIFO queue
) ( .
) (
:
- 7 0
1 .
-
7 2 .7
- .
- 3
3 .
-
15 .
) (
).(Beladys Anomaly
) (
.
) (
:
).(f
9 .
) (
-3
.
) (
:
-
.
- 2
1
7 7 2
.7
- .
- 3
1
2 1 .3
- 9
.
) (
9 .
-4
.
.
:
- : 7 1
.
- : 2
7
.2
- : .
- : 3 3
1 2
1 .
- .
) (
:
- :
.
- :stack
.
) (
-5
) (
) (reference bit 1
1
1
.
-
1
) (
1
.
1
1
) (
.
) (
-6
.
- :
.
: -
.
.
) (
:
: 11.1 :
) ( disk
) ( secondary storage :
.1 :
.
.2 .
.
) ( I|O byte
) ( RAM blocks
. block ) ( sector) (59
.
.
:
: .
:
.
) . ( 11.1
59
( & 4,069 s cWn U !S&UQ Z vXu( &UQ U (S vXu"! sector 32(Om &
( = 4. (& (S ( $~c 512(.
=ST: :11.1 IJK8 8QA 8MNO2
11.2
11.2.1 :
1-on-disk
2-in-memory
on-disk:
boot ,
) , ( blocks , .
:
in-memory:
FCB :
UNIX
.
WINDOWS NT
) ( system call .
: 11.2.2 ( Mounting and Partition) :
:
: .
,
.
,
1 24 C: . z:
.
) (GB30 GB 25
C: windows 2000 GB5 D
.
.
.
:
MBR(Master
) Boot Record ) . (Partition Table
, ) boot
. (sector MBR .
MBR BIOS .
MBR , .
) active( ,
MBR .
, .
.
.
) . (volume boot sector ,
, .
, .
: ) (primary .Extended
. .
:
,
. MBR .
. windows 9x
, FDISK .
Microsoft .
, . windows 9x
:
,
MBR ,
.
system commander
. ,
,
. .
.
) . (Extended Partition
, .
. .
, .
.
. ,
) windows
( 9x 24 ) A,B
( . ,
, . ,
. ,
.
, ,
.
:
.
.
.
FAT32 EXT3
...
,
) (C,D,E,F,G,H,I
ATA
.hda1 , hda5 , hda6 , hda7 , hda8
, partition
$fdisk -l
) shell
( :
$mount
/dev/hda1 on / type ext3 (rw,errors=remount-
ro)
tmpfs on /lib/init/rw type tmpfs
(rw,nosuid,mode=0755)
proc on /proc type proc
(rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs
(rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs
(rw,nosuid,nodev)
devpts on /dev/pts type devpts
(rw,noexec,nosuid,gid=5,mode=620)
nfsd on /proc/fs/nfsd type nfsd (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type
rpc_pipefs (rw)
, , hda5
:
mount point
.
dev/hda5/
mount
point
mount :
/mnt ,/media
. root
$mkdir /mnt/xxxxx
hda5 :
11.2.3 :
:
) ( kernel
system calls
,
windows,
mac os & linux
.
) ( ,
.
sun os unix
sun microsystems
unix UFS NFS
:
http://web.mit.edu/tytso/www/linux/ext2intro.html
http://209.85.129.104/search?q=cache:VkZOKtxXbiwJ:wapedia.m
obi/en/Virtual_file_system+virtual+file+systems&hl=ar&ct=clnk&
cd=31&gl=sa
Operating Systems Concepts
block
,
.
..
:
0 ) ( mark
\
0
0
.
.
)( Hash Table
, .
) ( linked list
.
:
11.4 :
..
-:
-:
(Contiguous Allocation) -:
) (address
)(block
-:
) (disk address ), (disk
)( accessing contiguous
.
)block
(address of first ) (
) (blocks
) (blocks .
) (blocks
.
:
*
,external fragmentation
,
.
* ,
, ,
!
) (
) (blocks
.
-:
) (blocks
-:
) (metadata .
) (Subsequent .
-:
-:
) (metadata .
( Linked Allocation) -:
) (
) (null )(node .
) (block
)(linked list .
) (blocks .
)( external fragmentation
, ) (block ,
).(blocks
) (access
) (access ,
.
,
.
) (reliability
) (pointer
.
)File-
(Allocation Table ) (volume
) (blocks ) (
.
-:
(Indexed Allocation) -:
) (block )(index
,
) (direct access ,
) (external fragmentation
, index block
! .
-:
http://filesystems.palconit.com/filesystems-file-allocation-
methods.html
http://www.people.fas.harvard.edu/~lib215/lectures/lect_p/lec
t04/6_Extras/bar_fs/index3.htm
Silberschatz, Galvin, Gagne: Operating System Concepts
.
)(.Free space list
)(free disk blocks
) . (
. .
.
.1 ""bit vector
.2 ":" linked list
.3 ""Grouping
.4 " " counting
":"bit vector
:
blocks )(2,3,4,5,8,9,10,11,12,13,1617,18
blocks bit map
""bit-manipulation instruction
:
.
microcomputers
.
:
block 2Kbyte 1 Gbyte
bit vector 1GB/2KB=32KB
": "blocks
block )( word bit map
block )(bit 1
block = ) bits * word words
( offset + block
:
word 5 bits
bit map :
block =) 17 = 2 + (3 * 5
":"linked list
.
..
, 2 .
3
4 5 8.
* ) (
* .
/
.
* .
:
blocks ) (2,3,4,5,8,9,10,11,12,13,17,18
blocks linked list
":"Grouping
* .
* .
blocks n block
blocks ) n-1 (
:
blocks
:
blocks ) (2,3,4,5,8,9,10,11,12,13,17,18
blocks (n=3) grouping
":"counting
)(contiguous blocks
) contiguous
(allocation
n ) (.
.
:
)+(
.1
blocks ) (2,3,4,5,8,9,10,11,12,13,17,18
blocks counting
:
www.ece.iupui.edu/~dskim/Classes/ECE408/ln-
os-ch11%20File-System
http://filesystems.palconit.com/filesystems-free-space-
management.html
http://blog.pixnet.net/nixchun/post/7989490
. Khadija akherfi
.
.
: 11.6
(I/O subsystem).
Disk Cache
Disk Cache
Buffer Cache .1
Buffer Cache
.
:
.
.
.bits Sectors
Sectors
)(Blocks Buffer Cache
.
:Buffer Cache
Bits Buffer
Cache .
Page Cache .2
Pages
Block
. blocks
Buffer Cache
.
Buffer Cache
.
Buffer Cache
page cache
.
.1 ) (
.
:
)
page cache
Buffer cache !(
Unified Buffer Cache
page
cache buffer cache
.
:
http://searchstorage.techtarget.com/sDefinition/0,,sid5_gci21
1963,00.html
http://www.faqs.org/docs/linux_admin/buffer-cache.html
http://www.usenix.org/publications/library/proceedings/useni
x2000/freenix/full_papers/silvers/silvers_html/
Operating system concepts-6th ed(page 434-435)
:
Mass-Storage Structure
, : .
.
.
. .
.
.
[im()S(S ( & o"i&W#n [SQX &WZ! . RAID [ )XS ,
.
)(l.bishy@gmail.com
1-12 :
:
.
1-1-12 :
) ( platters
: / , .
,( sectors ) . ) ( tracks
, 512 .
) ( arms ) heads
(
) / (
.
( cylinder ) . :
( Platters ) . ( cylinder
)
) ( .
.
:
( ) :
.
)
( .
: .
250 - 70
:
4200 : IPod
4200,5400 : 7200
7200 :
10000 : 15000
:
):(Transfer rate
) ( .
) ( ):(seek time
) / (
) (track .
) ( ):(rotational latency
/ ) (sector
.
): (Access Time
/
.
) ( )
( .
) ( .
.
.
.
)
(.
:
) : (Head Crash
- ,
-
) ( ,
.
.
.
)
(
.
:
.
.
.
SCSI
\ .
/ ,
,
, .
:
120 .
) . (EDB
.
EIDE,ATA,SATA,Fireware,USB,Fiber Channel,SCSI:
) ( Host Controller :
.
:
IDE ATA Internal Hard Disk :
GB 200. 4 GB .
SATA.
IDE .
SCSI
) ( :
" :
" . ,
3 .
( . )
EIDE
" . ) (
.
( . IDE
) ( IDE
IDE
.
EIDE IDE :
. IDE IDE
CD DVD .
SATA
.
SCSI
.
IDE )
( - - IDE
.
IDE IDE
.
.
.
2-1-12 :
):(access time
):(random access
,
.
:
.
- - - -
) ( Operating System Concepts
) (CompTIA A + Certification
WWW.IFOREX.COM
http://www.sanabes.com/
http://www.dcs.ed.ac.uk/home/stg/pub/D/disk.html
2-12 :
(Hard Disk ) ,
) ( Servers
.
.
) ( Formatting the HDD
.
( Physical Formatting ) .
( Logical Formatting ) .
WWW.IFOREX.COM
3-12 :
) ( (I/O ports)
. ) (
.
1-3-12 - ): (NAS
)(.Network attachment storage
) (NAS)(servers ) (NFS
) (CIFS ). (FTP
- ): (NAS connections
) (NAS .
2-3-12 - ): (SAN
)(WAN)(LAN
)(servers
:SAN
SAN
) (Tape libraries) (disk arrays ) (optical jukeboxes )
(Servers ).( Locally attached
- 2007 SAN
) .( Enterprise
:SAN
SAN iSCSI
.
(Direct Attached Storage )DAS .NAS
redundant
NAS
) DAS DAS
.(Hard Disk
SANs
.
SAN
) (Servers )
( boot ) SAN (.
:SAN
SAN
:SAN
).(Fiber Channel
SAN K$50-60 .
iSCSI
.
SAN
)(NAS) (SAN
:
- -
. NT .
http://en.wikipedia.org/wiki/Network-attached_storage
http://www.nas-san.com/differ.html
4-12 :
) (
.
.
) (controler
). (queue
.
) . ( scheduling policies
: , .
) : ( acess time
(seek time) . :
( rotational latency). :
) (disk bandwidth
) throughput (
) response time (
) ( scheduling .
head
.
.
: ) : ( FCFS
, .
.
.
.
) ( queue ) (
)( :
76,65,124,14,122,37,183,98
53 53 98
45
) ( 45=53 - 98 98 183 85
. 67
53 98 183 37 122
67 . 14 124 65
| + | 124 - 65 | + | 65 - 67
= 640 cylinders
640
.
: 37
122 14 . 124 ( wild jump
).
37 14 122
124 .
: FCFS
.
.
.
.
: ) ( )
: (SSTF
) ( SSTF ) ( shortest-seek-time-first )
(
.
.
.
. (
)
, ,
, .
.
53
| 53 - 65 | = 12, 65
67
= 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59
= 236 cylinders
236
.
37 53
208 .
) .( starvation
: .
: ) (: (SCAN ) -
) ( arm
,
.
) ( .
) ( ) (.
: ) ( elevator algorithm
.
: ) (: ( C - SCAN ) -
) (
.
, .
) ( circular list
.
= 12 + 2 + 31 + 24 + 2 + 59 + 16 + 199 + 14 + 37
= 396 cylinders
: ) : ( LOOK
) ( scan ) ( c-scan
.
)(
. .
= 12 + 2 + 31 + 24 + 2 + 59 + 169 + 23
= 322 cylinders
- - - - -
- - -
.
.
) ( .( processes ) pages
) (:
)
(
.
* M &cXc c P ! & &Wu & !S OQX&UQ &| ["X on &$ o& ) : s
( Swap-Space
)(*(swap-space &$ o(%S c[ !S [dOQ%S&UQ &| - U c& [""Z" &U &- ["%"hU
["Xd& [||ZS&$ o !~X($ Wn & oX~SU &. ["%"hU
( swap space
) .
( Paging system).
, .
( sawp file) :
.
RAM .
)(file
( external fragmentation ) .
)(disk partition
%20
.
Mount
) :( swap space
..
) : ( Device swap
) ( Device swap
.
( Device
) .swap space ) ( file system swap )
( device swap space ..
) ( )
( cluster clients .
,
) ( device swap .
): ( Pseudo-Swap
) ( pseudo swap
) ( paging .
)( .
. ( swap-space ) Linux
4
:
(page slot).
swap area) ( .
) ( ( page slot).
) (
) ( 1 )( page slot
) ( 3 :
) ) (
4(. 4
:
- - - -
:
.1 ) (
.
.2 ) interrupt
,
) .(( interrupt handler
...
.1 .
. .2
. .3
. .4
. .5
: :
. : .
. .
. .
. .
: :
:
)(Controller .
(Memory-mapped I/O) . .
.
: :
.
:
)(Character-stream or block
) (Sequential or random-access .
)(Synchronous or asynchronous .
) (Sharable or dedicated .
) (Speed of operation .
: :
....
.1 .
.2 .
.3 ) (buffer )(disk.
.4 .
.5 .
::
:
.1 ).(switches
.2 .
.3 (interrupts). .
.4 ),(CPU,.
ANSI C
: , .
: .
(stream I/O).2 .
) (
, :
.1Open() .
, .2 write().
...
.
:
,
.
- :
.
.
.
http://www.enterprisenetworksandservers.com/monthly/art.php?1503:
,
, , , .
(Device management).
.1
)) (control block unit(CBU
.
.2
) ,,(
.3 .
.4 ,
.
:
:
.1 )(Dedicated I/O Devices
.2 )(shared I/O Devices
.3 )(Virtual I/O Devices
:
.
, :
, ,
.
:
, ,
:
)).(Direct Access Storage Device(DASD
.
.
:
,
) (spooling system
, ,
:
.1
,
,
,
.
.2
.
.
)(IO\channels
.
) ( )(program channels
/ .
.
:
)(interrupt
: ,
.
interrupt:
interrupt-request line
. ,
" " interrupt handler
. interrupt handler ) (
,
. " raises"
. " catches" ""dispatch
interrupt handler clear .
interrupt handler :
_1 interrupt handler .
_2 interrupt handler
" polling" .
_3 interrupt
.
* ,
"".
microprocessors .
.
.
CPU .
CPU .A special set of registers
CPU CPU
:
http://www.science.unitn.it/~fiorella/guidelinux/tlk/node81.html
:
)(interrupt
) interrupt(: hardware
.code
* ) interrupt( : )
(.
* MSP interrupts
) interrupt( :
maskable- 1
non-maskable 2
: Maskable interrupt
.
:A non-maskable interrupt ,
)interrupt( .
* maskable interrupt
.
* ) interrupt( " " ) (2 interrupts
) interrupt(
)interrupt( .
:
http://cnx.org/content/m12321/latest/:
: interrupt
-1 :nonmaskable interrupt
.
-2 :maskable interrupt
. .
CPU context
switch Interrupt handler
memory
Interrupt handler Interrupt
CPU CPU .
:interrupt
Non-maskable interrupt: -1
.
Maskable.2
CPU
.
Interrupt vector:
Interrupt handler
handler
interrupt .
Interrupt priority levels:
CPU
interrupt
handler :
..1 .
.2
.3 .
.4
.5 .
:I\O interrupt
.1
.
.2 command word
channel HIO
.
.3
Spooling system
.
:Module .
* CPU.
* ADC, DAC, PWM, memory
..
* : DMA
.
Memory
peripheral systems data registers
control registers ..
DMA memory bus
memory .
.. DMA trigger
signals .. signals ..
:
:/http://cnx.org/content/m11867/latest
.
)(DMA :
)._(DMA
)( )(
.
)(
.
)(
.
http://en.wikipedia.org/wiki/Direct_memory_access:
):(DMA
CPU , Bios .
I/O CPU RAM
, RAM , CPU
CPU RAM .
, , CPU
.
, Cache memory CPU
.CPU
:
?CPU
Direct Memory Access : CPU
/ ))..((CPU
DMA , . CPU
, .RAM
channels DMA
)).. ((CPU
, DMA )) ((CPU ,
, )) ((interrupt DMA ,
)) (( real-time
..
: DMA
CPU
DMA )CPU (
http://en.wikipedia.org/wiki/Direct_memory_access:
) (polling
)(Polling
.
. ) (
.
) (poll
.
Polling
) (CPU ).(controller
controller CPU
controller command-ready bit in command register
:
Busy bit 0 controller
set to write bit in command register byte
data-out register set command-ready bit
: Operating System Concept