ECE329Notes(4)

ECE329Notes(4) - ECE 329 Operating Systems Chapter 4 1 of...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 329 Operating Systems Chapter 4 1 of 20 Process Management A program (application) is static. It is a set of instructions to complete some task. A process is dynamic. It is a single instance of a program running (or maybe only part of a program.) Process States Each process running on a machine may be in one of the states shown below. Queues Only one process may be running on a given processor at any given time, but many processes may be stored in ready or waiting queues. A Job Queue contains jobs waiting to be created. (long-term scheduling) A Ready Queue contains jobs waiting to run. (short-term scheduling) Waiting Queues contain jobs waiting for a specific event. (medium-term scheduling)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 329 Operating Systems Chapter 4 2 of 20 Job Creation To create a job or process, the computer Creates/obtains a free Process/Task Control Block . Fills the TCB/PCB with the necessary and appropriate data. Gathers necessary resources. (Memory (local), Files, Devices). Inserts job into Ready Queue. A process/job is always created by another process/job, creating in turn a parent/child relationship. In UNIX, the fork () instruction creates an exact copy of the parent. The only difference is that the child process is returned a zero, whereas the parent process is returned the PID (Process ID) of the child process. The child gets a copy of the parent’s memory necessary to do limited communications. Some systems have a join() or wait( ) instruction which waits for a child to finish, and then gets back a return value from the child. i = 3; switch ( fork() ) { case -1: /* Bad return value */ fprintf(stderr, "Fork() Error."); exit(1); break; case 0: /* child runs its code */ printf(“I’m the child. i = %d”, ++i); break; default: /* parent does its thing */ printf(“I’m the parent. i = %d”, i++); wait(); exit(0); } What would the code above do?
Background image of page 2
ECE 329 Operating Systems Chapter 4 3 of 20 Main Entry: de·mon Variant(s): or dae·mon / / Function: noun Etymology: Middle English demon, from Late Latin & Latin; Late Latin daemon evil spirit, from Latin, divinity, spirit, from Greek daimOn, probably from daiesthai to distribute -- more at TIDE Date: 13th century 1 a : an evil spirit b : a source or agent of evil, harm, distress, or ruin 2 usually daemon : an attendant power or spirit : GENIUS 3 usually daemon : a supernatural being of Greek mythology intermediate between gods and men 4 : one that has exceptional enthusiasm, drive, or effectiveness <a demon for work>
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ECE 329 Operating Systems Chapter 4 4 of 20 Process Control Block Each process in a computer has a process (task) control block associated with it. This area of memory contains vital (and sometimes not-so-vital) information about the process. A typical PCB is shown below:
Background image of page 4
ECE 329 Operating Systems Chapter 4 5 of 20 Use of the Process Control Block for Switching Processes Save State of P into PCB 0 0 Save State of P into PCB 1 1 Reload State of P into PCB 1 1 Reload State of P
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

ECE329Notes(4) - ECE 329 Operating Systems Chapter 4 1 of...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online