0% found this document useful (0 votes)
35 views18 pages

EEC2102-Week 6-Lecture-Chapter-5

Computer systems notes

Uploaded by

arnoldamram101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views18 pages

EEC2102-Week 6-Lecture-Chapter-5

Computer systems notes

Uploaded by

arnoldamram101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND

TECHNOLOGY

EEC2102: COMPUTER SYSTEMS

Presented by
Dr. Linus A. Aloo, PhD
References
Course Text Books
1. Campbell, J., Ciampa, M., Freund, S. M., Frydenberg, M., Sebok, S., Vermaat, M. E., Clemens, B. (2022).
2. Discovering Computers: Digital Technology, Data, and Devices. Cengage Learning: ISBN-10: 0357675363 ISBN-13:
9780357675366
3. Parsons, J. J. (2023). New perspectives on computer concepts 2016, comprehensive (21st ed.). Cengage Learning, Asia.
ISBN-13: 9780357674611
References Textbooks and Materials
1. Nagpal, D. P. (2008). Computer fundamentals. S. Chand Publishing. ISBN: 8121923883.
2. Microsoft Office documentation; support site, https://support.office.com
3. Microsoft Windows documentation; [online], Available: https://www.microsoft.com/en-us/store/b/software-
support
4. Stallings W., (2010) Computer Organization and Architecture: Designing for Performance, Prentice Hall 10th
Edition
5. Performing with Computers by Iris Blanc.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 1


CHAPTER 5: OPERATING SYSTEM SUPPORT

Chapter Objectives:

At the end of this sub-unit module, students should be able to:

 Summarize the key functions of an operating system (OS).

 Discuss the evolution of OS for early simple batch systems to modern complex systems.

 Explain the differences among long-, medium-, and short-term scheduling.

 Understand the reason for memory partitioning and explain the various techniques that are used.

 Assess the relative advantages of paging and segmentation.

 Define virtual memory.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 2


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.1. Operating System Overview
Operating System Objectives and Functions
 An OS is a program that controls the execution of application programs and acts as an
interface between applications and the computer hardware. Its two principal objectives
include:
■ OS makes a computer more convenient to use [i.e. OS as a user/computer interface]
■ OS allows the computer system resources to be used efficiently [OS as resource manager].
a) The operating system as a user/computer interface
 Fig. 5.1. shows a hierarchical arrangement of the hardware and software used in
providing applications to a user.
 The utilities implement frequently used functions that assist in program
development, the management of files and the control of I/O devices

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 3


CHAPTER 5: OPERATING SYSTEM SUPPORT

5.1. Operating System Overview: Operating System Objectives and Functions


a) The operating system as a user/computer
interface
 Once an application has been
developed by a programmer and is
running, it invokes the utilities to
perform certain functions.
 The most important system
program is the OS which hides
hardware details from the
programmer while providing a
convenient interface for using the
system.

Figure 5.1 Computer Hardware and Software Structure


10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 4
CHAPTER 5: OPERATING SYSTEM SUPPORT
5.1. Operating System Overview: Operating System Objectives and Functions
a) The operating system as a user/computer interface
The OS typically provides services in the following areas:
■ Program creation: The OS assists the programmer in creating programs by providing a variety of facilities and
services, such as editors and debuggers, as utility programs .
■ Program execution: The OS handles all steps to be performed to execute a program e.g. loading instructions
and data into main memory, initializing I/O devices and files.
■ Access to I/O devices: The OS takes care of the details for each I/O device (its instructions set or control
signals) so that the programmer can think in terms of simple reads and writes.
■ Controlled access to files: OS controls access to files as it understands the nature of the I/O device (e.g. disk
drive) and also the file format on the storage medium.
■ System access: In a shared system with multiple users, the OS controls access to the system as a whole and to
specific system resources.
■ Error detection and response: In case of hardware or software errors, the OS has to respond to clear the error
condition with minimal impact on running applications.
■ Accounting: A good OS collects usage statistics for various resources and monitors performance parameters
such as response time.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 5


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.1. Operating System Overview: Operating System Objectives and Functions
The operating system as a user/computer interface
Fig.5.1 also indicates three important interfaces in a typical computer system:
■ Instruction set architecture (ISA): ISA defines the repertoire of machine language instructions
that a computer can follow. This interface is the boundary between hardware and software.
■ Application binary interface (ABI): The ABI defines a standard for binary portability across
programs.
■ Application programming interface (API): The API gives a program access to the hardware
resources and services available in a system through the user ISA supplemented with high-level
language (HLL) library calls.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 6


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.1. Operating System Overview: Operating System Objectives and Functions
The operating system as resource manager
 A computer is a set of resources for the movement,
storage, and processing of data and for the control
of these functions.
 The OS is responsible for managing these
resources.
 The main resources that are managed by the OS are
as shown in Figure 5.2.
 A portion of the OS is in main memory. This
includes the kernel, or nucleus, which contains the
Figure 5.2 The Operating System as Resource Manager
most frequently used functions in the OS.
10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 7
CHAPTER 5: OPERATING SYSTEM SUPPORT
5.1. Operating System Overview: Operating System Objectives and Functions
Types of Operating Systems
 There are two independent dimensions that are used to distinguish various types of operating
systems.
 The first dimension specifies whether the system is batch or interactive. In an interactive
system, the user/programmer interacts directly with the computer, usually through a
keyboard/display terminal, to request the execution of a job or to perform a transaction.
 In a batch system the user’s program is batched together with programs from other users and
submitted by a computer operator.
 After the program is completed, results are printed out for the user. Pure batch systems are
rare today.
 The other dimension specifies whether the system employs multiprogramming or not. With
multiprogramming, several programs are loaded into memory, and the processor switches
rapidly among them.
 The alternative is a uniprogramming system that works only one program at a time.
10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 8
CHAPTER 5: OPERATING SYSTEM SUPPORT

5.2. Multiprogrammed batch systems


 Simple batch systems (Fig.5.3a), even with the
automatic job sequencing were known to be
inefficient due to poor processor time
utilization (which can spend up to over 96%
of its time waiting for I/O devices to finish
transferring data!)
 Suppose that there is room for the OS and two
user programs.
 Now, when one job needs to wait for I/O, the
processor can switch to the other job, which
likely is not waiting for I/O (Figure 5.3b).
Figure 5.3 Multiprogramming Example

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 9


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.2. Multiprogrammed batch systems
 Furthermore, we might expand memory to hold three, four, or more
programs and switch among all of them (Figure 5.3c).
 This technique is known as multiprogramming, or multitasking. It is
the central theme of modern operating systems.
 The most notable additional feature that is useful for multiprogramming
is the hardware that supports I/O interrupts and DMA.
 Multiprogramming operating systems are fairly sophisticated compared
to single-program, or uniprogramming, systems.
 To have several jobs ready to run, the jobs must be kept in main
memory, requiring some form of memory management.
 In addition, if several jobs are ready to run, the processor must decide
which one to run, which requires some algorithm for scheduling.
Figure 5.3 Multiprogramming Example

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 10


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.3. Time- sharing systems
 In a time-sharing system, multiple users simultaneously access the system through terminals, with the
OS interleaving the execution of each user program in a short burst or quantum of computation.
 The user may not notice that the processor time is shared among n users.
 Both batch multiprogramming and time-sharing use multiprogramming. The key differences are listed in
Table 5.1.
Table 5.1 Batch Multiprogramming versus Time Sharing

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 11


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.4. Scheduling
 Scheduling is based on how computer processes are organized for execution. It’s important in multiprogramming.
 The term process refers to a program in execution or that entity to which a processor is assigned.
 It is a more general term than job. Table 5.2 shows four types of scheduling.
Table 5.2 Types of Scheduling
Scheduling Type Description
Long-term The decision to add to the pool of processes to be executed. The long-term scheduler controls the degree of
scheduling multiprogramming by determining which programs are admitted to the system for processing.

Medium-term The decision to add to the number of processes that are partially or fully in main memory. Medium-term
scheduling scheduling is based on the swapping function.

Short-term The decision as to which available process will be executed by the processor. The short-term scheduler,
scheduling also known as the dispatcher, executes frequently and makes the fine-grained decision of which job to execute
next. The operation of a short-term scheduler is based on the concept of process state.
I/O scheduling The decision as to which process’s pending I/O request shall be handled by an available I/O device.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 12


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.4. Scheduling
Short-Term Scheduling

 The operation of a short-term scheduler is based on the concept of process


state.
 The status of a process changes a number of times in its lifetime and its status
at any point in time is known as a state.
 At minimum, there are five defined states for a process (Figure 5.4):
■ New: A program is admitted by the high-level scheduler but is not yet ready to
execute.
■ Ready: The process is ready to execute and is awaiting access to the processor.
■ Running: The process is being executed by the processor.
■ Waiting: The process is suspended from execution waiting for some system
resource, such as I/O.
Figure 5.4 Five- State Process Model
■ Halted: The process has terminated and will be destroyed by the OS.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 13


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.4. Scheduling
Scheduling Techniques

 Figure 5.5 shows the major elements of the OS involved in the


multiprogramming and scheduling of processes.
 The OS receives control of the processor at the interrupt handler if an
interrupt occurs and at the service-call handler if a service call occurs.
 Once the interrupt or service call is handled, the short-term scheduler
is invoked to select a process for execution.
 To do its job, the OS maintains a number of queues:
1. The long-term queue is a list of jobs waiting to use the system.
2. The short-term queue consists of all processes in the ready
state.
3. Finally, there is an I/O queue for each I/O device. Figure 5.5 Key Elements of an Operating
System for Multiprogramming

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 14


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.5 Memory Management
Introduction

 Memory management is the task of subdividing the memory dynamically by the


OS.
 Memory management is vital in efficient use of a processor by minimizing idle time.
 It also allows the memory to be allocated efficiently to pack as many processes into
memory as possible.
Swapping
 We have a long-term queue of process requests, typically stored on disk (Fig.5.6).
 These are brought in, one at a time, as space becomes available.
 As processes are completed, they are moved out of main memory.
 A more sophisticated scheme, involving virtual memory, improves performance over
simple swapping. Figure 5.6 The Use of Swapping
 But this requires us to understand partitioning and paging.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 15


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.5 Memory Management
Partitioning

 Partitioning of the available memory as shown in Fig. 5.7, can be carried out in
fixed-size partitions but not necessarily of equal sizes. In this case, a process
brought into the memory is made to occupy the smallest available partition that can
accommodate it.
 But this creates memory gaps leading to wastage of useful memory space.
 For instance, a process that requires 3M bytes of memory would be placed in the 4M
partition of Figure 5.10b, wasting 1M that could be used by another process.
 A more efficient approach is to use variable-size partitions.
 When a process is brought into memory, it is allocated exactly as much memory as it
requires and no more.
 But this can lead to a more fragmented memory, which although can be tackled by
Figure 5.7 Example of Fixed
compaction, is not sufficient.
Partitioning of a 64-Mbyte Memory
10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 16
CHAPTER 5: OPERATING SYSTEM SUPPORT
5.5 Memory Management
Paging

 Both unequal fixed-size and variable-size partitions are inefficient in the use
of memory.
 Suppose, however, that memory is partitioned into equal fixed-size chunks that
are relatively small, and that each process is also divided into small fixed-size
chunks of some size.
 Then the chunks of a program, known as pages, could be assigned to available
chunks of memory, known as frames, or page frames.
 At most, the wasted space in memory for that process is a fraction of the last page.
 Figure 5.8 shows an example of the use of pages and frames.
 At a given point in time, some of the frames in memory are in use and some are
free. The list of free frames is maintained by the OS. Process A, stored on disk,
consists of four pages. Figure 5.8 Allocation of Free Frames

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 17


CHAPTER 5: OPERATING SYSTEM SUPPORT
5.5 Memory Management
Virtual Memory
 Virtual Memory is based on the concept of demand paging, which simply means that each page of a process is brought
in only when it is needed, that is, on demand.
 When it brings one page in, it must throw another page out; this is known as page replacement.
 In essence, the OS tries to guess, based on recent history, which pages are least likely to be used in the near future.

Segmentation
 There is another way in which addressable memory can be subdivided, known as segmentation.
 Whereas paging is invisible to the programmer and serves the purpose of providing the programmer with a larger
address space, segmentation is usually visible to the programmer.
 Segmentation allows the programmer to view memory as consisting of multiple address spaces or segments.
 Segments are of variable, indeed dynamic size. Typically, the programmer or the OS will assign programs and data to
different segments.
 This organization has a number of advantages to the programmer over a non-segmented address space:
1. It simplifies the handling of growing data structures.
2. It allows programs to be altered and recompiled independently without requiring that an entire set of programs be
relinked and reloaded.
3. It lends itself to sharing among processes.
4. It lends itself to protection.

10/15/2024 EEC 2102 Computer Systems Lecture Notes by Dr. L. A. Aloo 18

You might also like