Professional Documents
Culture Documents
()8
Process Synchronization
: )Logical Add Space (
( )order ( . )Data Consistency
Share data Concurrency data inconsistency data consistency . Process Synchronization
& Counter --
. interleaving
* ( : Race condition )
( )1 . Concurrency
( )2 ( ) .
* .
: Counter ++ :
* : Atomic operation .
* Race condition ( ) .
10
.........
Rear
()
In ==== Next free slot
.............
Front
()
Out
:
* ( )printer spooler . slots
* ( )Printer daemon ( Module ) Next file table print
Out .
* A & B M A . S B
Front Front Rear . Rear
)10( ( )Y Y= 10 .
- ( )Y ( )10 )Y( Y= 10 11 = Rear
( )
process ) Critical Section ( ( )Critical region .
( +)
Each process has a code segment , called critical section in which share data is accessed and changed
The remainder of the process code is called the remainder section .
* ) Critical Section ( .
/ . Mutual Exclusion
Mutual Exclusion
.
:
: .
( )1 : Disabling Interrupts
timer Enabling . timer
( )2 : Mutual Exclusion With Busy Waiting
Lock - Variable
)0(
( )1 ( . )0 )1(
. Busy Waiting
Deadlock
( )source ( )
( )1 : Mutual Exclusion ( . )
( )
B
P1
P2
)p2( ( )B .
)p1( ( )A .
( +)
()9
Memory Management :
CPU
Memory Manger :
( )1 :
.
.
( )2 ,
( )3 .
: HD Main )terminate( Main . HD
* ( :
)
** :
( )1 Mono Programming
( )2 Multi Programming
( )
.
Process
Operating system
** :
( )1 ( )
( )2 CPU . I /O Devices
( )3 .
** :
( )1 Volatile Memory . Main Memory
( ) 2 Non Volatile Memory . Hard Disk
:
On line hard disk Off line - Magnetic tape magnetic disk
( +)
**
( )1 Waiting Queue
( )2
( Internal Fragmentation ) FIFO
( Memory Manger )
Starvation
:
() ( )skips ( )8 .
() Partition .
* External Fragment Partition & Partition ...
/ 50
:
* :
( )1 . .
( )2 Main Memory H.D
O. S Process Killing Dead Lock .
* Memory Manger
.
(( First Fit )1 ) : .
(( Worst Fit )4 ) : ( . )
(( Quick Fit )5 ) :
. .
: Memory Management with Variable Partition
External Fragment
.
External Fragment Process
. Memory Compact
/
Keeping Track .
/ :
/1 ( 50 ) 489
/2 ( 489 ) 50
* ( ) . Starvation
*
489 .
( +)
:
* : Keeping Track :
) ( (1) Memory Management with Bit map :
Allocation bit .
- S.O ( )1 Bit Process ( )0 Bit.
1
0
0
1
0
0
1
1
1
0
0
1
0
1
1
0
0
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
1
size
(process )p /h
address
:
P1
P2
8
14
:
6
H
Null
(3) Memory Management with Buddy system :
( )1000 ( )500 ,500 Buddy
( . )2 , 4 , 16
1024
512
512
128
128
64 64
( +)
( )10
Devices Management :
I/O
: ,
:
( ) 1 Block Devices
( )2 Character Devices
*
( ) .
*
()
:
( )1 ( Mechanical Component )
( )2 ( Electronic Component )
Devices Controller
CPU .
? Why Electronic Component
O / S Mechanical Controller
:
( )1 Device Independence
.
( )2 Error Handling
Devices Controller
O / S
O / S .
( )3 : Synchronization
I / O
I / O I / O
( ) .
(: Sharable / Dedicated Devices )4
( +)
User level I / O Software
Device Independent Operating System Software
Device Driver
Interrupt Handlers
Hardware
( )1 : Interrupt Handlers
( )BIOS
.
( )2 : Device Driver
DMA Controller
Buffer
( +)
:
Disk Drivers
Disk Controller
Memory
Cpu
System Bus
( )1 Disk Drivers .
( Disk Controller )2
. Driver
Block
Block Seek Time
Latency time
** : Free Space Management
( )1 : Bit map .
( )2 Linked List .
( )3 Grouping
.
( +)
* * Disk Scheduling
SYS Call :
( )1 / .
( )2 ( )
( )3 .
( )4 .
(( ))
.
.
,
,
------------------------------------------------- 2012( )
osmansada@gmail.com
( +)