11
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Q:Process Stateu 有有有 ? 有有有有有有有 transition? As a process executes, it changes state new: The process is being created running: Instructions are being executed waiting: The process is waiting for some event to occur ready: The process is waiting to be assigned to a processor terminated: The process has finished execution

Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

Embed Size (px)

DESCRIPTION

Q:Process Stateu 有哪些 ? 何種情形下會做 transition?. As a process executes, it changes state new : The process is being created running : Instructions are being executed waiting : The process is waiting for some event to occur ready : The process is waiting to be assigned to a processor - PowerPoint PPT Presentation

Citation preview

Page 1: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:Process Stateu有哪些 ?何種情形下會做transition?

As a process executes, it changes state

new: The process is being created

running: Instructions are being executed

waiting: The process is waiting for some event to occur

ready: The process is waiting to be assigned to a processor

terminated: The process has finished execution

Page 2: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.2 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:所謂 context主要是包含哪些資料 ? 或問所謂 PCB主要是包含哪些資料 ?

Information associated with each process

Process state

Program counter

CPU registers

CPU scheduling information

Memory-management information

Accounting information

I/O status information

Page 3: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.3 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:何謂 Context Switch?

When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a context switch

Context of a process represented in the PCB

Context-switch time is overhead; the system does no useful work while switching

Time dependent on hardware support

Page 4: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.4 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:(a)簡單說明 OS如何由 process A 到 B 做 context switching?

Page 5: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.5 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:Describe the difference among short-term, medium-term, and long-term scheduling?

Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue

Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU

Page 6: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.6 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Addition of Medium Term Scheduling

Page 7: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.7 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Schedulers (Cont)

Short-term scheduler is invoked very frequently (milliseconds) (must be fast)

Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow)

The long-term scheduler controls the degree of multiprogramming

Page 8: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.8 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:說明 I/O-bound process & CPU-bound process?

Processes can be described as either:

I/O-bound process – spends more time doing I/O than computations, many short CPU bursts

CPU-bound process – spends more time doing computations; few very long CPU bursts

Page 9: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.9 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:何謂 Interprocess Communication?可能方法 ?

Processes within a system may be independent or cooperating

Cooperating process can affect or be affected by other processes, including sharing data

Reasons for cooperating processes:

Information sharing

Computation speedup

Modularity

Convenience

Cooperating processes need interprocess communication (IPC)

Two models of IPC

Shared memory

Message passing

Page 10: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.10 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Communications Models

Page 11: Q:Process Stateu 有哪些 ? 何種情形下會做 transition?

3.11 Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8th Edition

Q:Blocking (TRX) vs nonblocking?

Message passing may be either blocking or non-blocking

Blocking is considered synchronous

Blocking send has the sender block until the message is received

Blocking receive has the receiver block until a message is available

Non-blocking is considered asynchronous

Non-blocking send has the sender send the message and continue

Non-blocking receive has the receiver receive a valid message or null