Processes


Process State Diagram Process Control Block (PCB)



Download 0.57 Mb.
Page2/7
Date02.08.2022
Size0.57 Mb.
#59263
1   2   3   4   5   6   7
Lecture 2 Processes
Lecture 1 Introduction

Process State Diagram

Process Control Block (PCB)

  • Each process is represented on the OS by a PCB
  • It is the data structure used by the OS
  • Process state – new, running, waiting etc
  • Program counter – address of next instruction to
  • be executed for this process

  • CPU registers – indicates general purpose register, index registers and accumulators etc.
  • Memory management information – include such information as the base and limit register, page tables or segment tables in memory
  • I/O status information – I/O requests, I/O devices allocated , a list of open files
  • Accounting information – CPU used, clock time elapsed since start, time limits

Threads

  • Is a lightweight process
  • Basic unit of CPU utilisation
  • Consists of :
    • Program counter – keeps track of which instruction to execute next
    • Registers – holds its current working variable
    • Stack – execution history
  • Thread States
  • bornState :A thread is just created
  • readyState :The thread is waiting for CPU
  • Running :System assigns the processor to the thread
  • Sleep: :A sleeping thread becomes ready after the designated sleep time expires
  • Dead :The execution of the thread is finished

Process vs Thead

  • Process
    • Is heavy weight or resource intensive
    • process takes more time to create
    • Execution is very slow
    • Cant share the same memory area
    • Communication between two processes is difficult
  • Thread
    • Is light weight, taking lesser resources
    • Takes less time to create
    • Execution is very fast
    • Threads can share same memory area
    • Communication between two threads is easy

Multithreading

  • Is when a number of thread execute at the same time within a process
  • In a multithreaded program, even when some portion of it is blocked, the whole program is not blocked
  • The rest of the program continues running if multiple CPUs are available
  • Multithreading therefore gives the best performance
  • Multithreading can simplify code and increase efficiency
  • Kernels are generally multithreaded

Download 0.57 Mb.

Share with your friends:
1   2   3   4   5   6   7




The database is protected by copyright ©ininet.org 2024
send message

    Main page