Docsity

Operation System, Process, Thread, Lecture notes of Operating Systems

Toggle sidebar
bg1
01914955028
sahina akter
Process:
• A program in execution
• An instance of a program running on a computer
• The entity that can be assigned to and executed on a processor
• A unit of activity characterized by the execution of a sequence of instructions, a current state, and
an associated set of system instructions
Consist of three segments
» Text
-contains the code (instructions)
» Data
-Global variables
» Stack
-Activation records of procedure
-Local variables
•Note:
» data can dynamically grow up
» The stack can dynamically grow down
Consists of three components
» An executable program
- Text
» Associated data needed by the program
- Data and stack
» Execution context of the program
- All information the operating system needs to manage the process
• Registers, program counter, stack pointer, etc…
- A multithread program has a stack and execution context for each thread
pf3
pf4
pf5
pf8

Partial preview of the text

Download Operation System, Process, Thread and more Lecture notes Operating Systems in PDF only on Docsity!

sahina akter Process:

  • A program in execution
  • An instance of a program running on a computer
  • The entity that can be assigned to and executed on a processor
  • A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system instructions Consist of three segments

» Text

  • contains the code (instructions) » Data
  • Global variables » Stack
  • Activation records of procedure
  • Local variables
  • Note: » data can dynamically grow up » The stack can dynamically grow down

Consists of three components

» An executable program

  • Text » Associated data needed by the program
  • Data and stack » Execution context of the program
  • All information the operating system needs to manage the process
  • Registers, program counter, stack pointer, etc…
  • A multithread program has a stack and execution context for each thread

Process Elements:

• Identifier

• State

• Priority

• Program counter

• Memory pointers

• Context data

• I/O status information

• Accounting information

Process Control Block

Two-State Process Model

• Process may be in one of two states

» Running

» Not-running

Not-Running Process in a Queue

The Process Model

Figure 2-1. (a) Multiprogramming of four programs. (b) Conceptual model of four independent,

sequential processes. (c) Only one program is active at once.

  • With the CPU switching back and forth among the processes, the rate at which a process performs its computation will not be uniform and probably not even reproducible if the same processes are run again.
  • Thus, processes must not be programmed with built-in assumptions about timing.
  • When a process has critical real-time requirements special measures must be taken to ensure that they do occur.

Threads

• Unit of execution.

• A single process can have multiple threads that share global data and address space

with other threads running in the same process, and therefore can operate on the same

data set easily.

• A single process may contain several threads that work together as a coherent whole.

Threads and Processes

• Error exit (voluntary): exit(2), Exitprocess

• Fatal error (involuntary): divide by 0, illegal instruction

• Killed by another process (involuntary): kill procID, end task

Process States

Three states of a process:

• Running (actually using the CPU at that instant)

• Ready (runnable; temporarily stopped to let another process run)

• Blocked (unable to run until some external event happens).

Process States

Figure 2-2. A process can be in running, blocked, or ready state. Transitions between these states

are as shown.

Using Two Queues

Multiple Blocked Queues

Implementation of Processes (1)