Y10-04-P21: OS: Process Management

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Y10-04-P21:

OS: process management


Y10-04-P21: OS: process management

Learning objectives
In this lesson you will learn to:
• Describe how an OS uses scheduling to give each active
process a share of CPU time
• Describe how the OS uses paging and virtual memory to share
RAM between processes

For more information and additional student activities see Topic 3.2
of the student book.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Operating systems
Previously you learned the main functions of operating systems:

• process management
• file management
• user management
• peripheral management.

You learned that the OS stores files in directories organised in


hierarchies.

In this lesson, you will learn about how the OS manages processes.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Processes
• When a program is run, it is copied from the secondary storage
into the memory so that it can be executed by the CPU.
• Programs in the memory that are being executed (or waiting to be)
are called processes.
• Some processes are visible to the user, but there are many that
run in the background.
• Often there are many processes that need to access the CPU
simultaneously.
• As each CPU can only carry out one instruction at a time, the OS
is responsible for allocating CPU time to each of the processes,
alongside access to other hardware such as the memory and
peripherals.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Multitasking
• Modern CPUs and operating systems are able to make multiple
processes available at the same time.
• This is known as multitasking.
• The OS is responsible for ensuring that all processes are able to
execute by allocating them a fair share of time with the hardware.
It is important to understand this distinction:

• A CPU with one core – allows one instruction in one


process at a time.
• A CPU with multiple cores – allows one instruction in
one process at a time on each core.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Processes
• It is possible to see the processes that your computer is running.
• In Windows, you can use the Task Manager to view the processes
running on your machine.
• The Task Manager gives you an overview of how many resources
each process is using.
• In this example, you can
see that there a number of
background processes
listed – lots of them!

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Scheduling
• The OS uses a scheduling algorithm to ensure that all processes
that are queueing to be carried out get a share of CPU time.
• There are three main scheduling algorithms that OSs use:
• First In First Out (FIFO) – this processes the queue in the
order that items arrive. The process at the front of the queue
runs first, then the next, etc.
• Shortest Job First – the process which is closest to being
completed goes first.
• Round-robin – processes are allocated a time slice (an amount
of time in the CPU). If the process is not complete at the end of
its time, it goes to the back of te queue. Higher priority tasks
are given more time slices.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Memory

• The CPU is not the only hardware component processes need


to access.
• The other major component that processes need to use is the
computer’s memory.
• The size of memory is finite, so the OS needs an efficient way of
sharing it between processes.
• When a process is loaded into memory, the OS assigns it a
series of addresses to use. These blocks of addresses are
called pages.
• Management of these pages is often done with a paging
algorithm. Manipulating an entire process (instructions and
data) can be done by manipulating its pages in memory.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Virtual memory
• When many processes are running a computer’s RAM may
become full.
• When this happens, the OS needs to temporarily move some of
the contents of the RAM to a space on the hard drive.
• The part of the hard drive designated as an extension to the main
memory is called virtual memory.
• The OS moves the pages of memory associated with a process in
RAM to the hard disk. Thereby freeing up some memory.
• When that process is ready to be executed again, the OS moves
the page from virtual memory back into RAM.
• You might have witnessed this happening (particularly on an older
machine) when you’ve reopened a program that had been
minimized for a while – the program may have taken a few
seconds to be ready to reload.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-04-P21: OS: process management

Wrap up: you have learned how to…


 Describe how an OS uses scheduling to give each active process
a share of CPU time.
• Processes queue up to use the CPU
• The process at the front of the queue gets exclusive use of the
CPU whilst the others wait for their turn
 Describe how the OS uses paging and virtual memory to share
RAM between processes.
• Non-running processes are moved out of RAM into virtual
memory. They are moved in units called pages. This is done to
free up space for new processes.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.

You might also like