CHAPTER 4 PROCESS AND THREADS

Get Started. It's Free
or sign up with your email address
Rocket clouds
CHAPTER 4 PROCESS AND THREADS by Mind Map: CHAPTER 4 PROCESS AND THREADS

1. PROCESS CONTROL BLOCK

1.1. contain process element

1.2. possible to interrupt a running process and later resume execution as if the interrupt had not occur

1.3. created and manged by the OS

1.4. IMPORTANT: It allows support for multiple processes

2. Process

2.1. DEFINITION

2.1.1. program in execution or an instance running program

2.1.2. a container for threads, which has its own memory

2.1.3. entity can be assigned to & executed on a processor

2.1.4. when the file loaded to RAM (must have state)

2.2. ELEMENTS

2.2.1. ESSENTIAL ELEMENTS

2.2.1.1. 1) Program code

2.2.1.1.1. shared with other processes that are executing the same program.

2.2.1.2. 2) A set of data associated with that code

2.2.1.2.1. processor begin to execute program code and refer the executing entity as a process

2.2.2. CONTAIN IN PROCESS CONTROL BLOCK

2.2.2.1. 1) Identifier

2.2.2.1.1. An identity of process to make a process unique, so that the OS can distinguish it among others.

2.2.2.2. 2) State

2.2.2.2.1. A state of process

2.2.2.3. 3) Priority

2.2.2.3.1. Level of priority of which process needs to be executed first

2.2.2.4. 4) Program Counter (PC)

2.2.2.4.1. Holds the address of next execution that needs to be referred to CPU

2.2.2.5. 5) Memory Pointers

2.2.2.5.1. Address that points to the program code and data associated with the process

2.2.2.6. 6) Context Data

2.2.2.6.1. Data present in registers while the process is executing

2.2.2.7. 7) I/O Status Information

2.2.2.7.1. Records down the details or info of I/O devices resources

2.2.2.8. 8) Accounting Information

2.2.2.8.1. Account of the process

3. OS Management of Application Execution

3.1. Resources available to multiple application.

3.2. The processor switched among multiple application to be progressing.

3.3. Processor and I/O device can be used efficiently

3.3.1. used efficiently - OS maximize the productivity, minimize the usage of resources.

4. PROCESS STATES

4.1. TRACE

4.1.1. The behavior of an individual process -list the sequence o instructions that execute for that process

4.1.2. The behavior of the processor- show how the traces of various process are interleaved

4.2. DISPATCHER

4.2.1. Small program - switches the processor from one process to another

5. PROCESS CREATION

5.1. DEFINITION

5.1.1. Occurs when a new process is to be added to those currently being managed processes

5.1.2. OS builds data structures that are used to manage the process and allocates address space in main memory to the process

5.2. REASONS

5.2.1. New batch job - It will read the next sequence of job control commands.

5.2.2. Interactive logon - A user at a terminal logs on to the system

5.2.3. Created by OS to provide a service - To perform a function on behalf of a user program, without the user having to wait.

5.2.4. Spawned by existing process - A user program can dictate the creation of a number of processes

5.3. TYPES

5.3.1. Process spawning

5.3.1.1. - when the OS create a process at the explicit request of another process

5.3.2. Parent process

5.3.2.1. - the original creating process

5.3.3. Child process

5.3.3.1. - the new process

6. PROCESS TERMINATION

6.1. DEFINITION

6.1.1. A process to indicates its completion

6.1.2. A batch job should include a HALT instruction or an explicit OS service call for termination.

6.1.3. For an interactive application, the action of the user will indicate when process is completed. (e.g. log off, quitting an application)

6.2. REASONS

6.2.1. 1) Normal Completion

6.2.2. 2) Time limit exceeded

6.2.3. 3) Memory unavailable

6.2.4. 4) Bounds violation

6.2.5. 5) Protection errors

6.2.6. 6) Arithmetic errors

6.2.7. 7) Time overrun

6.2.8. 8) I/O failure

6.2.9. 9) Invalid instructions

6.2.10. 10) Privileged instructions

6.2.11. 11) Data misuse

6.2.12. 12) Operator or OS intervention

6.2.13. 13) Parent termination

6.2.14. 14) Parent request

7. SUSPENDED PROCESS

7.1. SWAPPING

7.1.1. Involving moving part of all of a process from main memory to disk

7.1.2. None of the processes in main memory is in the Ready state,

7.1.3. the OS swaps one of the blocked processes out on to disk into a suspend queue.

7.2. CHARACTERISTICS

7.2.1. The process not immediately available for execution

7.2.2. The process was placed in a suspended state by an agent to prevent execution. e.g. an agent = itself , parent process, OS.

7.2.3. The process may or may not be waiting on an event.

7.2.4. The process may not be removed from this state until the agent explicitly orders the removal.

7.3. REASONS

7.3.1. Swapping - OS needs to release sufficient main memory to bring in a process that is ready to execute.

7.3.2. Other OS reason - OS may suspend a background or utility process or a process that is suspected of causing a trouble.

7.3.3. Interactive user request - User may wish to suspend execution program for purposes of debugging.

7.3.4. Timing - Process may be executed and suspended while waiting for the next time interval.

7.3.5. Parent process request - Parent process may wish to suspend execution of a descendant to examine or modify the suspended process or to coordinate various activity of a descendant.

8. DIFFERENCE

8.1. PROCESSES

8.1.1. The unit of resource ownership

8.1.2. Process includes a virtual address space to hold the process image.

8.1.3. Also known as task.

8.1.4. The unit of resource allocation and protection.

8.1.5. A virtual address space that holds the process image.

8.1.6. Protected access to:

8.1.6.1. Processors

8.1.6.2. Other processes

8.1.6.3. Files

8.1.6.4. I/O resources

8.2. THREADS

8.2.1. Scheduling/ Execution

8.2.2. Follows an execution path that may be interleaved with other process.

8.2.3. Has an execution state

8.2.4. The unit of dispatching

8.2.5. Also known as lightweight process

9. THREADS

9.1. DEFINITION

9.1.1. - The unit of dispatching

9.1.2. - Lightweight process

9.2. CHARACTERISTIC

9.2.1. - Has an execution state (e.g. Running, Ready, etc)

9.2.2. - Saved thread context when not running.

9.2.3. -An execution stack

9.2.4. -Some per-thread static storage for local variables

9.2.5. -Access to the memory and resources of its process (all threads of a process share this)

9.3. BENEFITS

9.3.1. Take less time to create a new thread than a process.

9.3.2. Less time to terminate a thread than a process.

9.3.3. Switching between two threads takes less time than switching between processes.

9.3.4. Threads enhance efficiency in communication between programs.

9.4. TYPES

9.4.1. Single Threaded Approaches

9.4.1.1. A single thread of execution per process, in which the concept of a thread is not recognized.

9.4.1.2. MS-DOS

9.4.2. Multithreaded Approaches

9.4.2.1. The ability of an OS to support multiple, concurrent paths, of execution within a single process

9.4.2.2. Java run-time

10. PROCESS MODELS

10.1. Two- State Process Model

10.1.1. RUNNING : Similar to Ready state which it has not been executed

10.1.2. NOT- RUNNING : The process is being executed.

10.2. Five- State Process Model

10.2.1. NEW : New request is made.

10.2.2. READY: Process is ready for execution

10.2.3. RUNNING: Process is being executed

10.2.4. BLOCKED: Process is in waiting state due to certain requests such as I/O completion.

10.2.5. EXIT: Process is terminated.

10.3. With One State Model

10.3.1. NEW: A new request is made.

10.3.2. READY: Process is ready for execution.

10.3.3. RUNNING: Process is being executed.

10.3.4. BLOCKED: Process is in waiting state due to certain request such as I/O completion.

10.3.5. SUSPEND: Swapping occurs to move process from main memory to hard disk.

10.3.6. EXIT: Process is terminated.

11. OPERATING SYSTEM CONTROL STRUCTURES

11.1. To manage processes and resources

11.2. OS constructs and maintain tables of information about each entity that it is managing.

11.3. Types of tables maintain by OS: - Memory tables - I/O tables - File tables - Process tables