CSC204 - Chapter 3.1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

PRACTICAL

APPROACH OF
OPERATING
SYSTEM
CSC204

Chapter 3: OS– System View


OVERVIEW
3.0 OS - System View
3.1Process Management
3.1.1 Process Concepts
3.1.2 Single Tasking
3.1.3 Multitasking

3.2Memory Management
3.2.1 Memory Hierarchy
3.2.2 Physical Memory
3.2.3 Virtual Memory
OVERVIEW
3.0 OS - User View
3.3I/O Management
3.3.1 I/O System Organization
3.3.2 I/O Communication Techniques
3.3.3 Direct Memory Access
3.3.4 Buffering

3.4OS Internal Protection and Security


3.4.1 User Authentication
3.4.2 Basic Resource Protection
3.1 PROCESSS MANAGEMENT

3.1.1 Process Concepts


3.1.2 Single Tasking
3.1.3 Multitasking
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
What is a program ??
 Inactive@passive entity, such as a file stored on
a disk.
 To an operating system, a program/job/ task
is a unit of work that has been submitted by
user.
 “Job” is usually associated with batch
systems.
 “Task” is usually associated with multitasking
systems.
What is a process ??
 A process is a program in execution.

 Active entity, which requires a set of resources, including a processor and special registers to
perform its function.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

 A process includes :-
Stack (contain temporary data)
Data section (contain global
variables)
Heap (memory that is automatically
allocated during process runtime)
 2 types of process :-
O/S process = executes system codes
User process = executes user codes.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

 Each process is represented in the OS


by a process control block (PCB) or
task control block.
 Each PCB is unique, there are no two
PCB’s alike
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

CPU scheduling information


includes a process priority, Identify the current state new,
pointers to scheduling queues or ready, running, waiting,
other scheduling parameters terminated
Accounting information includes
the amount of CPU and real time
Counter indicated the address of used, time limits, process
next instructions to be executed numbers and etc.
by this process
Accumulators, index, stack
pointers, state info when
interrupt occurs.
Memory management
information, value of base & limit
registers, page tables, segment
tables used by O/S
I/O status information list of I/O
devices allocate for this process.
List of open files.

Process Control Block (PCB)


3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

Process State
 As a process executes, it changes state.
 The state of a process is defined in part by
the current activity of that process.
 Only one process can be running on any
processor at any instant.
 However, many processes may be ready
and waiting for their turn to be processed.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

 Process State includes:


New : The process is being
created.
Running : Instructions are being
executed.
Waiting : The process is waiting for
some event to occur (such as an I/O
completing or reception of a signal)
Ready : The process is waiting
to be assigned to a processor
Terminated : The process has finished
execution
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

Diagram of Process State


Admitted Finished
Hold(New)

Interrupt Exit

Ready Running
Job pool

Scheduler dispatch
I/O or
event I/O or event
completion wait
Handled by Process Scheduler Waiting

Handled by Job Scheduler


3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
 In a processing cycle, a process might have to wait for computer
resources, as it waits, the process will be placed in a queue

Job queue - set of all processes in the


system, that are waiting to be moved
into memory.
Ready queue - set of all processes
residing in main memory, ready and
waiting to be executed by CPU.
Device @ I/O queue - set of processes
waiting for an I/O device
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

 O/S control the selection of the


process from one queue to another.
 The selection of the process is carried
out by a scheduler
1. Long Term Scheduler (Job Scheduler)
2. Short Term Scheduler (Process @ CPU
Scheduler)
3. Medium Term Scheduler
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
Long Term Scheduler

 Also known as Job Scheduler.


 Selects processes from the job queue and
loads them into memory for execution.
 Long-term scheduler is invoked very
infrequently and slow.
 The long-term scheduler controls the
degree of multiprogramming and a good
combination of I/O bound and CPU bound
processes.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

Short Term Scheduler


 Also known as Process or CPU Scheduler.
 Select from among the processes that are
ready to execute and allocates the CPU to
one of them.
 Short-term scheduler is invoked very
frequently and very fast.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
Medium Term Scheduler

 The process will be swapped out from


memory and swapped back in later for
continuation.
 This swapping scheme is to reduce the
degree of multiprogramming and balance
the process mixture.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts
Context Switch

 Happens when switching the CPU to


another process.
 Saving the state of the old process and
loading the saved state for new process.
3.1 PROCESS
MANAGEMENT
3.1.1 Process Concepts

 Process Manager performs job scheduling,


process scheduling and interrupt
management.
 In single-tasking, processor is busy only
when user is executing a job—at all other
times it is idle.
Processor management is simple.
 In multiprogramming environment,
processor must be allocated to each job in
a fair and efficient manner.
Requires scheduling policy and a
scheduling algorithm. Eg. FCFS, SJF, SRTF,
RR etc.
3.1 PROCESS
MANAGEMENT
3.1.2 Single Tasking
 Only one program executed at a time
 Begins running a new program on a
computer system as soon as the
current program is completed.
 Example: Palm OS for Palm handheld
computers
 Single tasking is divided by 2 types of
processing:
1) Sequential Processing
Memory layout of
early computer 2) Batch Processing
systems
3.1 PROCESS
MANAGEMENT
3.1.2 Single Tasking
Sequential Processing
 New programs or commands cannot be
started until the preceding program or
command has completed.
 Example: when you enter commands
line by line.
 Will complete executing each
command before going on to the next
3.1 PROCESS
MANAGEMENT
3.1.2 Single Tasking
Batch Processing
 Jobs or several user programs are grouped
into a batch and processed one after
another in a continuous stream.
 Not interactive so user cannot interact
with program while the program is
running.
 Example: The customer does not receive
a bill for each separate credit card
purchase but one monthly bill for all of
that month's purchases.
3.1 PROCESS
MANAGEMENT
3.1.2 Single Tasking
Batch Processing
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

 Multi-tasking OS provides the ability to run


more than one program at once.
 Multi-tasking is divided by 2 types of
processing:
1) Multiprogramming
2) Time Sharing Systems
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

Multiprogramming
 Batched and non-interactive
 Multiprogramming increases CPU
utilization by organizing jobs so that the
CPU always has one to execute
The operating system keeps several jobs
in memory simultaneously
It picks and begins to execute one of the
jobs in memory
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

Multiprogramming
 Eventually, the job may have to wait for
some task to complete
 In a multiprogrammed system, the OS
switches to another job and executes it
 The first job finishes waiting and gets the
CPU back
 As long as at least one job needs to
execute – the CPU is never idle
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

Multiprogramming

Memory Layout for Multiprogrammed System


3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

Time Sharing Systems


 Time sharing is a logical extension of
multiprogramming
 In time sharing systems, the CPU executes
multiple jobs by switching among them,
but the switches occur so frequently that
the users can interact with each program
while it is running
 It requires an interactive computer system
providing direct communication between
user and the system
3.1 PROCESS
MANAGEMENT
3.1.3 Multi-tasking

Time Sharing Systems

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy