19. 5. CPU
1
1. Process id)
2. Program code)
3. Data)
4. Process control block)
4.1 Pointer)
4.2 Process state)
4.3 Program id)
4.4 Program counter)
4.5 Register)
4.6 CPU scheduling information)
4.7 Memory management information)
4.8 Account information)
4.9 I/O status information)
20. pointer process state
process id
process counter
registers
list of open files
:::
:::
5. PSW (Program status word)
6. Properties of process)
6.1 Priority)
6.2 Authority)
6.3
2
6
1. New : The process is being created.)
2. Ready : The process is waiting to be assigned to a processor.)
3. Running : Instructions are being executed.)
4. Wait : The process is waiting for some event to occur.)
5. Block : The process is blocked for some event to occur.)
6. Terminate : The process has finished execution.)
4
1. ready state)
2. running state)
21. 3. blocked state)
4. suspend state)
3
process
process CPU process
1. Device queue I/O child process
job queue queue process
ready, blocked running
process I/O devices device queue device queue
processes queue
scheduler Device queue
scheduler scheduler process
2. Contect switch process
22. OS
Process Process
saving the stat of the old process and loading
the saved state for the new process context switch
context of process PCB of a process
Mutual exclusion
process
Critical region process Critical region
4
mutual exclusion
1. process critical region
2.
3. process critical region block process
4. process critical region
Mutual exclusion with busy waiting
5. Disable interrupt
6. Lock variable
7. Strict alternation
8. Peterson's solution
9. TSL instruction
4
process
Parent process) Children process)
process tree of
process on a typical UNIX system
1. Process creation)
23. process process execute
1.
(The parent continues to execute concurrently with its children.)
2.
(The parent waits until some or all of its children have terminated.)
process process address
1. address
(The child process is a duplicate of the parent process.)
2. load address
(The child process has a program loaded into it.)
2. Process termination)
3
1. resource
2.
3. OS
process Linux
[root@yn1 root]# ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1376 84 ? S Oct08 0:12 init
root 1482 0.0 0.0 1440 156 ? S Oct08 0:32 syslogd -m 0
root 1486 0.0 0.0 1368 4 ? S Oct08 0:00 klogd -x
rpc 1504 0.0 0.0 1540 0 ? SW Oct08 0:00 [portmap]
rpcuser 1523 0.0 0.0 1680 0 ? SW Oct08 0:00 [rpc.statd]
named 1620 0.0 1.9 41836 5040 ? S Oct08 6:16 [named]
root 1635 0.0 0.1 3508 300 ? S Oct08 0:05 /usr/sbin/sshd
root 1649 0.0 0.1 2024 368 ? S Oct08 0:02 xinetd -stayalive
root 1659 0.0 0.0 1596 88 ? S Oct08 0:00 /usr/sbin/vsftpd
root 1680 0.0 0.2 5920 548 ? S Oct08 0:52 [sendmail]
smmsp 1689 0.0 0.1 5716 316 ? S Oct08 0:00 [sendmail]
apache 9825 99.9 0.0 0 0 ? RW Oct08 15286:48 [httpd]
root 10719 0.0 0.0 17200 96 ? S Oct18 0:02 /usr/sbin/httpd
apache 15017 0.0 3.0 22708 7860 ? S Oct18 0:07 [httpd]
24. apache 15018 0.0 2.8 23940 7312 ? S Oct18 0:06 [httpd]
apache 18350 0.0 3.3 27072 8604 ? S 08:23 0:06 [httpd]
root 22018 0.0 0.8 6268 2108 ? S 13:16 0:00 [sendmail]
5. Cooperating process)
2 Independent process)
Cooperating process)
1. Information sharing)
2. Computation speedup)
3. Modularity)
4. Convenience)
6. Interprocess communication : IPC)
6.1 Message-passing system)
IPC 2 Send(message)
Receive(message) -
- Direct or indirect communication (
- Symmetric or asymmetric communication (
- Automatic or explicit buffering (Explicit =
- Send by copy or send by reference
- Fixed-sized or variable-sized messages
6.2 Naming)
6.2.1 Direct communication
A
B
send(B,message) B
6.2.2 Indirect communication
receive(A,message) A
25. mailbox port
mail box mail box
share mail box
mail box mail box 3
1. Queue mailbox block First In First
Out)
2. Pipe mailbox
3. Stack mailbox First In Last Out)
6.3 Synchronization)
send receive
blocking nonblocking
deadlock 4
- Blocking send : The sending process is blocked until the message is received by the
receiving process or by the mailbox.
- Nonblocking send : The sending process sends the message and resumes operation.
- Blocking receive : The receiver blocks until a message is available.
- Nonblocking receive: The receiver retrieves either a valid message or a null.
6.4 Buffering)
3
- Zero capacity
- Bounded capacity
- Unbounded capacity
7.
1. Single processing) Sequential processing (one result / m
cycles)
2. Multi processing) Pipelining (one result / cycle)
3. Parallel processing) Parallel processing (n results / m
cycles)
26. 6.
process
Parent process) Children process)
process tree of
process on a typical UNIX system
1. Process creation)
process process execute
1.
(The parent continues to execute concurrently with its children.)
2.
(The parent waits until some or all of its children have terminated.)
process process address
1. address
(The child process is a duplicate of the parent process.)
2. load address
(The child process has a program loaded into it.)
2. Process termination)
3
1. resource
2.
3. OS
process Linux
[root@yn1 root]# ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1376 84 ? S Oct08 0:12 init
root 1482 0.0 0.0 1440 156 ? S Oct08 0:32 syslogd -m 0
root 1486 0.0 0.0 1368 4 ? S Oct08 0:00 klogd -x
rpc 1504 0.0 0.0 1540 0 ? SW Oct08 0:00 [portmap]
rpcuser 1523 0.0 0.0 1680 0 ? SW Oct08 0:00 [rpc.statd]
54. 1. operating system) OS)
2. Apache Web server HTTPD Web Server Apache
Homepage Homepage Browser Web server
HomePage web server
mod_perl,mod_python
mod_php HTML
Download website www.apache.org
3. MySQL MySQL AB
SQL
Web
Server) Server-Side Script)
4. joomla CMS
CMS CMS Content
Management System"
Code HTML, PHP, SQL
CMS Code