Operating Systems Lecture Notes: Processes, Slides of Operating Systems

A set of lecture notes from a university course on Operating Systems, focusing on the topic of processes. The notes cover the definition of a process, the control flow of a process, process types, how the operating system creates a process, private address spaces of a process, the five-state process model, context switching, and creating new processes using the fork() system call. The document also includes examples and explanations of how parent and child processes can communicate.

Typology: Slides

2020/2021

Uploaded on 12/15/2021

Obaidullah6184
Obaidullah6184 🇵🇰

5 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Foundation University Islamabad
Processes
Operating Systems
LECTURE#01
Processes
Processes
Dr. Shariq BASHIR
Operating Systems
FALL 2019
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Operating Systems Lecture Notes: Processes and more Slides Operating Systems in PDF only on Docsity!

Operating Systems

LECTURE#

Processes Processes

Dr. Shariq BASHIR

[email protected]

Operating Systems

FALL 2019

Operating Systems

Course Learning Objectives

  1. Study the fundamental concepts of operating system design and implementation.
  2. Understand the interaction between user- level applications and the underlying operating system.
  3. Practical understanding of operating system topics such as processes/threads, file systems, and memory management.

Operating Systems 4

“ “TentativeTentative”” GradingGrading

  • (^) Assignments 15%
  • (^) Quizzes /Class Test 10%
  • (^) Midterm 25%
  • (^) Final Exam 50%

5

What If No Operating System? What If No Operating System?

  • (^) All we have is bare hardware
  • (^) You want to run a program  (^) How do you load it?  (^) How do you run it?  (^) What happens when it completes?
  • (^) Need at least some minimal Operating System (OS) to do these functions

Operating Systems

  • (^) A computer program in execution on a machine is a process
  • (^) More formally:
    • (^) A Sequential Stream of Execution in its own address space

Process

7

Operating SystemsControl Flow of a

Process

inst 1 inst 2 inst 3 … inst n

  • (^) Computers do Only One Thing
    • (^) From startup to shutdown, a CPU simply reads and executes a sequence of instructions, one at a time. Physical control flow Time

Operating Systems

Process Types

  • (^) If all processes are I/O bound,
    • (^) System will go free
  • (^) If all processes are CPU bound,
    • (^) Devices will go unused
    • (^) System will again be unbalanced 10

Operating Systems

How OS Creates a Process

  • (^) Assign a unique process identifier
  • (^) Allocate space to the process
  • (^) Creates process control block
    • (^) Ex: add new process to linked list used for scheduling processes

Operating SystemsPrivate Address Spaces of a

Process

  • (^) Each process has its own private address space Heap Segment run-time heap (managed by malloc) Stack Segment user stack (created at runtime) Code Segment 0 %esp (stack pointer) memory invisible to user code 0xc 0x 0x Data Segment loaded from the executable file 0xffffffff

Operating Systems

Five-State Process Model

New New Exit Exit Admit Release Running Running Ready Ready Dispatch Time-out Blocked Blocked Event occurs (^) Event wait 14

Operating Systems

CPU Switch From Process to

Process

  • (^) Part of OS (Operating System) responsible for switching the processor among the processes is called Dispatcher 16

Operating Systems

Context Switching Example

Tim eoutI/O Tim eout Tim eout

Operating Systems

Trace from Processors point of view

Tim eoutI/O Tim eout Tim eout

Operating Systems

  • (^) Processes may themselves go on to create new processes
  • (^) A new process is created by a fork() system call (in case of only linux) 20

Creating new Process