Chapter 3 process description and control l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 67

Chapter 3 Process Description and Control PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Operating Systems: Internals and Design Principles. Chapter 3 Process Description and Control. Seventh Edition By William Stallings. Operating Systems: Internals and Design Principles.

Download Presentation

Chapter 3 Process Description and Control

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Chapter 3 process description and control l.jpg

Operating Systems:Internals and Design Principles

Chapter 3Process Description and Control

Seventh Edition

By William Stallings

Operating systems internals and design principles l.jpg

Operating Systems:Internals and Design Principles

The concept of process is fundamental to the structure of modern computer operating systems. Its evolution in analyzing problems of synchronization, deadlock, and scheduling in operating systems has been a major intellectual contribution of computer science.




MIT Press, 1980

Summary of earlier concepts l.jpg

Summary of Earlier Concepts

  • A computer platform consists of a collection of hardware resources

  • Computer applications are developed to perform some task

  • It is inefficient for applications to be written directly for a given hardware platform

  • The OS was developed to provide a convenient, feature-rich, secure, and consistent interface for applications to use

  • We can think of the OS as providing a uniform, abstract representation of resources that can be requested and accessed by applications

Os management of application execution l.jpg

OS Management of Application Execution

  • Resources are made available to multiple applications

  • The processor is switched among multiple applications so all will appear to be progressing

  • The processor and I/O devices can be used efficiently

Process elements l.jpg

Process Elements

  • Two essential elements of a process are:

    • When the processor begins to execute the program code, we refer to this executing entity as a process

Process elements6 l.jpg

Process Elements

While the program is executing, this process can be uniquely characterized by a number of elements, including:

Process control block l.jpg

Process Control Block

Contains the process elements

Makes it possible to interrupt a running process and later resume execution as if the interruption had not occurred

Created and managed by the operating system

Key tool that allows support for multiple processes (multiprogramming)

Process states l.jpg

Process States

Process execution l.jpg

Process Execution

Traces of processes of figure 3 2 l.jpg

Traces of Processes of Figure 3.2

Figure 3.3

Each process runs to completion

Combined trace of processes of figure 3 2 l.jpg

Combined Trace of Processes of Figure 3.2

Figure 3.4

Two state process model l.jpg

Two-State Process Model

  • A process may be in one of two states:

    • running

    • not-running

Queuing diagram l.jpg

Queuing Diagram

Table 3 1 reasons for process creation l.jpg

Table 3.1 Reasons for Process Creation

Process creation l.jpg

Process Creation

Process termination l.jpg

Process Termination

  • There must be a means for a process to indicate its completion

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

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

Slide17 l.jpg


Reasons for Process Termination

Five state process model l.jpg

Five-State Process Model

Process states for trace of figure 3 4 l.jpg

Process States for Trace of Figure 3.4

Using two queues l.jpg

Using Two Queues

Multiple blocked queues l.jpg

Multiple Blocked Queues

Suspended processes l.jpg

Suspended Processes

  • Swapping

    • involves moving part or all of a process from main memory to disk

    • when none of the processes in main memory is in the Ready state, the OS swaps one of the blocked processes out on to disk into a suspend queue to make room for a new process, or a previously suspended process that is now ready to execute

    • Commonly used in systems that had no virtual memory; less likely to be used with virtual memory since processsize can be controlled through thepaging mechanism.

One suspend state l.jpg

One Suspend State

Two suspend states l.jpg

Two Suspend States

Characteristics of a suspended process l.jpg

Characteristics of a Suspended Process

  • The process may or may not be waiting on an event

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

  • The process is not immediately available for execution

  • The process was placed in a suspended state by an agent: either itself, a parent process, or the OS, for the purpose of preventing its execution

Reasons for process suspension l.jpg

Reasons for Process Suspension

Table 3.3 Reasons for Process Suspension

Processes and resources what does the os need to know to manage processes resources l.jpg

Processes and ResourcesWhat does the OS need to know to manage processes & resources?

Os control tables l.jpg

OS Control Tables

Memory tables l.jpg

Memory Tables

  • Used to keep track of both main (real) and secondary (virtual) memory

  • Processes are maintained on secondary memory using some sort of virtual memory or simple swapping mechanism

I o tables l.jpg

I/O Tables

  • Used by the OS to manage the I/O devices and channels of the computer system

  • At any given time, an I/O device may be available or assigned to a particular process

File tables l.jpg

File Tables

  • Information may be maintained and used by a file management system, or the OS itself

Process tables l.jpg

Process Tables

  • Must be maintained to manage processes

  • Process tables must have some reference to memory, I/O, and file tables

    • e.g., pointers from each individual process entry to its data in the other three sets of tables.

  • The tables themselves must be accessible by the OS and therefore are subject to memory management

  • Processes are represented by a process image

Process control structures pcb l.jpg

Process Control Structures - PCB

Process Components

Process Attributes

Each process has associated with it a number of attributes that are used by the OS for process control –maintained in a Process Control Block (PCB)

The collection of program, data, stack, and attributes is referred to as the process image

Process image location will depend on the memory management scheme being used

  • A process must include a program or set of programs to be executed

  • A process will consist of at least sufficient memory to hold the program(s) and data of that process

  • The execution of a program typically involves a stack that is used to keep track of procedure calls and parameter passing between procedures

Process attributes l.jpg

Process Attributes

Process identification l.jpg

Process Identification

Memory tables may be organized to provide a map of main memory with an indication of which process is assigned to each region

similar references will appear in I/O and file tables

When processes communicate with one another, the process identifier informs the OS of the destination of a particular communication

When processes are allowed to create other processes, identifiers indicate the parent and descendents of each process

  • Each process is assigned a unique numeric identifier

    • otherwise there must be a mapping that allows the OS to locate the appropriate tables based on the process identifier

  • Many of the tables controlled by the OS may use process identifiers to cross-reference process tables

Processor state information l.jpg

Processor State Information

X86 eflags register l.jpg

X86 EFLAGS Register

Process control information l.jpg

Process ControlInformation

  • The additional information needed by the OS to control and coordinate the various active processes

  • Forms the 3rd part of the PCB (along with process ID and processor state information)

Slide39 l.jpg



of a Process

Control Block

Structure of process images in virtual memory l.jpg

Structure of Process Images in Virtual Memory

Process list structures l.jpg

Process List Structures

Role of the process control block l.jpg

Role of the Process Control Block

  • The most important data structure in an OS

    • contains all of the information about a process that is needed by the OS

    • blocks are read and/or modified by virtually every module in the OS

    • defines the state of the OS

  • Difficulty is not access, but protection

    • a bug in a single routine could damage process control blocks, which could destroy the system’s ability to manage the affected processes

    • a design change in the structure or semantics of the process control block could affect a number of modules in the OS

Modes of execution l.jpg

Modes of Execution

User Mode

System Mode

more-privileged mode

also referred to as control mode or kernel mode

kernel of the operating system

  • less-privileged mode

  • user programs typically execute in this mode

Slide44 l.jpg

Table 3.7



of an




Process creation45 l.jpg

Process Creation

  • Once the OS decides to create a new process it:

Process context switching l.jpg

Process (Context) Switching

A process switch may occur any time that the OS has gained control from the currently running process. Possible events giving OS control are:

System interrupts l.jpg

System Interrupts



An error or exception condition generated within the currently running process

OS determines if the condition is fatal

moved to the Exit state and a process switch occurs

action will depend on the nature of the error

  • Due to some sort of event that is external to and independent of the currently running process

    • clock interrupt

    • I/O interrupt

    • memory fault

  • Time slice

    • the maximum amount of time that a process can execute before being interrupted

Mode switching l.jpg

Mode Switching

Mode switching49 l.jpg

Mode Switching

  • A mode switch is distinct from a process switch.

  • A mode switch can take place without changing the state of the executing process

  • However, while processing a mode switch the OS may decide a process switch is needed; e.g., if the mode switch was caused by a timer interrupt or a process request for I/O

Change of process state l.jpg

Change of Process State

If the currently running process is to be moved to another state (Ready, Blocked, etc.), then the OS must make substantial changes in its environment

The steps in a full process switch are:

Execution of the operating system l.jpg

Execution of the Operating System

Execution within user processes l.jpg

Execution WithinUser Processes

Security issues l.jpg

Security Issues

An OS associates a set of privileges with each process

Typically a process that executes on behalf of a user has the privileges that the OS recognizes for that user

Highest level of privilege is referred to as adminstrator, supervisor, or root access

A key security issue in the design of any OS is to prevent, or at least detect, attempts by a user or a malware from gaining unauthorized privileges on the system and from gaining root access

System access threats l.jpg

System Access Threats


Malicious Software

Most sophisticated types of threats to computer systems

Can be relatively harmless or very damaging

  • Often referred to as a hacker or cracker

    • Objective is to gain access to a system or to increase the range of privileges accessible on a system

    • Attempts to acquire information that should have been protected

Countermeasures intrusion detection l.jpg

Countermeasures: Intrusion Detection

“A security service that monitors and analyzes system events for the purpose of finding, and providing real-time or near real-time warning of, attempts to access system resources in an unauthorized manner” (RFC 2828)

May be host or network based

An intrusion detection system (IDS) comprises three logical components:

IDSs are typically designed to detect human intruder behavior as well as malicious software behavior

Countermeasures authentication l.jpg

Countermeasures: Authentication

  • “The process of verifying an identity claimed by or for a system entity.” (RFC2828)

  • An authentication process consists of two steps:

    • Identification

    • Verification

  • Four general means of authenticating a user’s identity:

Countermeasures access control l.jpg

Countermeasures: Access Control

Implements a security policy that specifies who or what may have access to each specific system resource and the type of access that is permitted in each instance

Mediates between a user and system resources

A security administrator maintains an authorization database

An auditing function monitors and keeps a record of user accesses to system resources

Countermeasures firewalls l.jpg

Countermeasures: Firewalls

Unix svr4 l.jpg

Unix SVR4

  • Uses the model where most of the OS executes within the environment of a user process

  • Two process categories: system processes and user processes

  • System processes run in kernel mode

    • executes operating system code to perform administrative and housekeeping functions independent of any specific user process.

  • User Processes

    • operate in user mode to execute user programs and utilities

    • operate in kernel mode to execute instructions that belong to the kernel

    • enter kernel mode by issuing a system call, when an exception is generated, or when an interrupt occurs

Unix process states l.jpg

UNIX Process States

Unix process state transition diagram l.jpg

UNIX Process State Transition Diagram

A unix process l.jpg

A Unix Process

Table 3 11 unix process table entry l.jpg

Table 3.11 UNIX Process Table Entry

Table 3 12 unix u area l.jpg

Table 3.12UNIX UArea

Process creation65 l.jpg

Process Creation

Process creation is by means of the kernel system call, fork( )

This causes the OS, in Kernel Mode, to:

After creation l.jpg

After Creation

  • After creating the process the Kernel can do one of the following, as part of the dispatcher routine:

    • stay in the parent process

    • transfer control to the child process

    • transfer control to another process

Summary l.jpg


  • The most fundamental concept in a modern OS is the process

  • The principal function of the OS is to create, manage, and terminate processes

  • Process control block contains all of the information that is required for the OS to manage the process, including its current state, resources allocated to it, priority, and other relevant data

  • The most important states are Ready, Running and Blocked

  • The running process is the one that is currently being executed by the processor

  • A blocked process is waiting for the completion of some event

  • A running process is interrupted either by an interrupt or by executing a supervisor call to the OS

  • Login