You are on page 1of 184

lOMoARcPSD|17821011

EBook CSC204

Practical Approach Of Operation System (Universiti Teknologi MARA)

StuDocu is not sponsored or endorsed by any college or university


Downloaded by popsoda (amirahmadafiq@gmail.com)
lOMoARcPSD|17821011

PRACTICAL APPROACH
OF
OPERATING SYSTEMS
SECOND EDITION

MAZLAN OSMAN

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

PAKA PRINTING
Practical Approach of Operating Systems
Second Edition

Copyright © 2019 by AL-FATEH PUBLICATIONS

All Rights Reserved.

No parts of this book may be reproduced or stored in a


database retrieval system, distributed or transmitted in any
form or by any means either electronics, mechanical,
photocopying, recording or otherwise without the prior
written permission of publisher or author.

Published in Malaysia by:

AL-FATEH PUBLICATIONS
8001, Taman Harmoni
Jalan SMK Intan Zaharah
23000 Dungun
Terengganu

Printed in Malaysia by:

PAKA PRINTING
Jalan Besar Paka
23100 Paka
Terengganu

2 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Preface

Operating systems are an essential part of any computer


system. A course on operating systems is an essential part
of any computer-science education. This book is presented
as a text for an introductory course in operating systems at
the junior or senior undergraduate level or at the first-year
graduate level. It provides a clear description of the
fundamental concepts that underlie operating systems.

Learning operating system is very important to computer


science students. Without good understanding about
operating system, computer science student could face the
problem in their study especially about computer system
and computer programming.

This book consists of nine topics and each topic is related to


each other. Through this book the reader can learn about
the concept of operating system such as the functions, the
components and the booting concept. The reader also can
study about how operating system manages the file, the
computer processing, the memory and the input and output.
The operating system protection and security also covered
in this book through the last chapter.

I am very appreciates hearing from readers about any


suggestions and comments that identified in this book for
improvements. Thank you and happy reading.

MAZLAN OSMAN
Universiti Teknologi MARA
Terengganu, Malaysia
March 2019

3 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

TABLE OF CONTENTS

PREFACE

Chapter 1 1
Understanding of Operating System
Introduction
What is Operating System
Operating Systems and Computer System
History of Operating System
Operating System Strategies
Types of Operating Systems

Chapter 2 13
Functions and Components of Operating System
Understanding Operating System Components
Cooperation Issues
Characteristics of Modern Operating System
Application Program Interface
Operating Systems Design Issues

Chapter 3 25
Operating System Booting Concept
Booting Concept
Single OS Booting Process
Multiple OS Booting Process

Chapter 4 36
User Interfaces
Introduction
Command Line User Interface (CLI)
Graphical User Interface (GUI)
Natural Language Interface (NLI)
User Interface in Review

4 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Chapter 5 47
File System
Introduction
File System Concept
File Access Method
Directory Structure
File System Mounting
File Sharing
File Protection
File Allocation Method
File Technology

Chapter 6 67
Device Driver
Device Management
Device Driver
Device Controller
Device Driver Interface

Chapter 7 79
Process Management
Terms and Concepts
Process Concept
Single Tasking Processing
Multitasking Processing
Single Tasking versus Multitasking
Context Switching
Scheduling

Chapter 8 99
Memory Management
Memory Hierarchy
Physical Memory
Virtual Memory

5 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Chapter 9 123
Input Output Management
Introduction
Input Output System Organization
Input Output Communication Techniques
Input Output Buffering

Chapter 10 137
OS Protection and Security
Introduction
Security and Protection
User Authentication
Basic Resource Protection

References 153

6 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

UNDERSTANDING OF
OPERATING SYSTEM
Chapter 1

7 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
To understand an operating system is to understand the
workings of an entire computer system, because the operating
system manages each and every piece of hardware and software.
This chapter briefly describes how simple operating systems work
and how, in general, they’ve evolved. The following chapters
explore each component in more depth and show how its function
relates to the other parts of the operating system. In other words,
you see how the pieces work harmoniously to keep the computer
system working smoothly.

WHAT IS OPERATING SYSTEM


A computer system consists of software (programs) and
hardware (the physical machine and its electronic components).
Operating system is a piece of software that manages and
coordinates all of the hardware and all of the software. It controls
every file, device, every section of main memory and every
nanosecond of processing time and control who can use the
system and how. The operating system is the one program
running at all times on the computer usually called the kernel.

Goals of Operating System

Convenience
Operating system makes a computer more convenient to use.

Efficiency
Operating system allows the computer system resources to be
used in an efficient manner.

Ability to evolve
Operating system should constructed in such way as to permit
the effective development, testing and introduction of new system
functions without at the same time interfering with service.

8 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Functions of Operating System


Operating system plays important roles in computer system. The
main roles of operating system are:

• Operating system as a resource allocator. It means


operating system manages all the computer resources –
software and hardware.

• Operating system as a control program. It means


operating system controls execution of programs to
prevent errors and improper use of the computer.

• Operating system provides interface between user and


hardware. It means operating system acts as an
intermediary between a user of a computer and the
computer hardware.

• Operating system provides abstraction of the


hardware. It means operating system hide the
complexity of the underlying hardware and gives the user
a better view of the computer.

OPERATING SYSTEM AND COMPUTER


SYSTEM

Figure 1.1 Abstract view of OS and Computer System

9 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

HISTORY OF OPERATING SYSTEM

The earliest computers did not use an operating system at all.


Gradually, based on specific requirements, system programs were
developed to facilitate the use of computers. The evolution of
operating system software parallels the evolution of the computer
hardware it was designed to control. Here’s a very brief overview
of this evolution.

First Generation (1945 – 1955)


In the first computer generation, the computer uses vacuum
tubes and wires plug boards technology. After that, plug boards
replaced with punch cards as input devices. In this age, the first
commercial computer called ENIAC was developed. It uses 18K
vacuum tubes. In this generation, there is no operating system.

Figure 1.2 Computer ENIAC

10 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Second Generation (1955 – 1965)


In the second computer generation, the computer uses transistor
technology but punch cards are still used as input devices. In this
era, the first mainframe computer called IBM 701 was developed.

In this generation, the first operating system was developed


named JCL (Job Control Language). JCL provides batch
processing whereas a collection of program, data and commands
combined into a single unit and run one-at-a-time (from start to
end).Here, two computer languages were introduced in the second
generation – FORTRAN and Assembler.

Figure 1.3 Early Transistor

Third Generation (1965 – 1980)

In the third generation, the computer uses integrated-circuit


technology. In this generation, the first minicomputer was
developed - IBM System/360 & DEC PDPs.

11 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

In this generation, the multiprogramming and time-sharing


operating system were introduced.

Figure 1.4 Integrated Circuit

Fourth Generation (1980 – present)


In the third generation, the computer uses very-large-scale-
integration (VLSI) technology called microchip. In this
generation, several new types of operating system were
introduced as the following:

• Network Operating Systems such as Novell Netware, MS


LAN Manager/Windows.
• Server Operating Systems such as UNIX, Windows, Linux
• Multiprocessor Operating Systems
• Distributed Operating System
• Personal Operating Systems such as MS-DOS, Windows
XP/Vista, Mac OS X, Linux

Figure 1.5 Microchip

12 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 1.6 Migration of Operating System Concepts and


Features

OPERATING SYSTEM STRATEGIES


There are several strategies in developing operating system in
order to enhance the efficiency and efficiency of operating system
parallel with the development of computer system. The strategy
can be categorized into three phases:

Phase 1
During this phase, hardware is expensive and humans are cheap.
Users use computer at a console (single-user system) and using
mono-programming systems. Batch processing operating system
is implemented during this phase whereas jobs given to operating
system at one time and operating system process jobs one-after-
the-other. There is no human-computer interaction. Operating
system optimizes the resources utilization.

13 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Phase 2
During this phase, hardware is cheap and human are expensive.
Users use a cheap terminals and share servers (multiuser
system) and using multiprogramming systems. Time-sharing
operating system is implemented during this phase.
Multiprogramming support interactive computing model and has
different scheduling and memory allocation strategy. In this
phase, security and protection had more consideration and
attention.

Phase 3
During this phase, hardware is very cheap and humans are very
expensive. Personal computing and distributed computing arise
in this phase. In personal computing, one system could be
handled by one user and in distributed processing a lot of system
could be handled by one user. Four types of operating system are
implemented during this phase. There are Real-Time OS,
Networks OS, Distributed OS and Embedded OS.

TYPES OF OPERATING SYSTEM

Operating system for small and large computer can be divided


into five categories distinguished by response time and how data
is entered into the system.

Batch Operating System

During the earliest computers generations, users relied on


punched cards or tape input when job was entered by assembling
the cards into a deck and running the entire deck of cards
through a card reader as a group (a batch). Present day batch
systems aren’t limited to cards or tapes, but the jobs are still
processed serially without user interaction. The efficiency of a
batch system is measured in throughput – the number of jobs
completed in a given amount of time.

The following are the characteristic of batch operating system:

• Machines run from a console.

14 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Input Devices - Line printers; tape drives; card punches


• User did not interact directly with the computer.
✓ user prepared a job – combination of sequence of
commands, programs and data into single unit
✓ job submitted to computer operator
✓ output consists of result of the programs; dump of
the final memory; register contents for the
debugging appeared after minutes; hours; days
• Operating System have a major task
✓ Transfer control automatically from one job to the
next job.
✓ Resident in memory
• Operators batched jobs with similar needs and ran them
as a batch group.
• CPU often idle

Time Sharing Operating System


This operating system gives a faster turnaround then batch
systems, but is slower than real time system. The operating
system required the development of time sharing software, which
allows each user to interact directly with the computer system via
commands entered from a type-write like terminal. The operating
system provides immediate feedback to the user and response
time can be measured in fractions of a second.

The characteristic of timesharing systems:

• Provide direct communication between the user and the


system
• CPU executes multiple jobs by switching among them.
• Interactive computer system
• Response time should be short
• Allow many users share the computer where shorter CPU
time is needed for each user.
• Uses CPU scheduling and multiprogramming
• Jobs swapped in and out of main memory to the disk.

15 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Real Time Operating System

This operating system used in time-critical environment where


reliability is a key and data must be processed within a strict
time limit. The time limit need not be ultra-fast, but system
response time must meet the deadline or risk significant
consequences. There are two types of real-time operating systems
depend on the consequence of missing the deadline.

Hard Real-Time Operating System – risk total failure if the


predicted time deadline is missed.

• Critical tasks must complete on time.


• Secondary storage limited/none
• Data stored in ROM.

Soft Real-Time Operating System – suffer performance


degradation, but not total system failure, as a consequence of a
missed deadline.

• A critical task gets priority over other tasks and retains


the priority until it completes.
• It cannot be used for industrial control.
• It supports multimedia, VR and UNIX
• It needs advances OS features.

Hybrid Operating System

This operating system is a combination of batch and time-sharing


(interactive). It appear to be interactive because individual users
can access the system and get fast responses, but such system
actually accepts and runs batch programs in background when
interactive load is light.

Embedded Operating System


This operating system is placed inside other products to add
features and capabilities, for example embedded operating
system in electrical appliance, automobile. This operating system
has a very specific task and not interchangeable among systems.

Examples of embedded operating system are:

16 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Automobile engine fuel injection systems


• Home appliance controller
• Weapon systems
• iPod
• Digital camera
• Cell phone etc.

17 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. The general role of an operating system is to:

A. act as an interface between various Computers


B. provide a set of Services to system users
C. manage files for application programs
D. None of the above

2. What type of system is designed to perform one specific


function?

A. Real-time
B. Interactive
C. Hybrid
D. Embedded

3. The most important characteristic of distributed system:

A. is to keep several Jobs in memory


B. is to maximize CPU utilization
C. is to allow sharing of resources between hosts over
a wide distance
D. is to allow multiple machines to perform
computations of data on the shared storage

4. _______ is a computer system whereas computers place


inside other products to add features and capabilities.

A. Batch System
B. Embedded System
C. Time-sharing System
D. Real Time System

5. In the _______ computer generation, the first operating


system was developed named JCL.

A. First
B. Second
C. Third
D. Fourth

18 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

6. Which type of the operating system would be needed to


allow the students in a class to read a file that the lecturer
has open?

A. Real-time
B. Hybrid
C. Multiuser
D. Multitasking

7. Operating systems that can be modified, distributed and


shared are called _______.

A. close source
B. free
C. open source
D. proprietary software

8. Most operating systems are comprised of three main


components: _______, file system and shell.

A. desktop
B. kernel
C. user interface
D. code

9. Which of the following is NOT a characteristic of modern


operating system?

A. Multithreading
B. Batch Operating System
C. Symmetric Processing
D. Microkernel Architecture

10. X is a computer that uses integrated circuit technology


and multiprogramming or time sharing operating system.
X is refer to _______.

A. Zero Generation
B. First Generation
C. Second Generation
D. Third Generation

19 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

THE FUNCTIONS AND


COMPONENTS OF
OPERATING SYSTEMS
Chapter 2

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

UNDERSTANDING OPERATING SYSTEM


COMPONENTS
Figure 2.1 show the five essential managers of every operating
system: the processor manager, the memory manager, the file
manager, the I/O or device manager and the network manager.
Each manager works closely with the other managers and
performs its unique role regardless of which specific operating
system is being discussed. At the top of pyramid is the User
Command Interface, from which users issue commands to the
operating system.

Regardless of size or configuration of the system, each of


subsystem managers shown in Figure 2.1 must perform the
following tasks:

1. Monitor its resources continuously


2. Enforce the policies that determine who gets what, when,
and how much
3. Allocate the resource when it’s appropriate
4. De-allocate the resource when appropriate

Figure 2.1 Operating System Managers

20 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

User Command Interface


There are two types of User Command Interface:

Command-Line Interface (CLI)

CLI is an interface that accepts line command. User has to write


a command, a line at a time. For example, some common
commands in UNIX are cd, cp and ls and some command in MS-
DOS are dir, copy and md.

Graphical User Interface (GUI)


GUI is an interface that allows the user to activate operating
system commands by clicking on desktop icons or menus using a
pointing device such as a mouse or touch pad and screen. Usually
GUI implemented in Macintosh and Windows.

Processor Manager
• The Processor Manager decides how to allocate the central
processing unit (CPU). An important function of the
Processor manager is to keep track of the status of each
process. A process defines as a program in execution.

• The Processor Manager monitors whether the CPU is


executing a process or waiting for a READ or WRITE
command to finish execution. Once the Processor Manager
allocates the processor, it sets up the necessary registers
and tables and, when the job is finished or the maximum
amount of time has expired, it reclaims the processor.

• The Processor Manager has two levels of responsibility.


One is to handle jobs as they enter the system and the
other is to manage each process within those jobs.

• The first part is handled by the Job Scheduler, the high-


level portion of the Process Manager, which accepts or
rejects the incoming jobs.

21 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• The second part is handled by the Process Scheduler, the


low-level portion of the Process Manager, which is
responsible for deciding which process gets the CPU and
for how long.

Memory Manager
• The Memory Manager is in charge of main memory, also
known as RAM (Random Access Memory).

• The Memory Manager checks the validity of each request


for memory space and, if it is legal request, it allocates a
portion of memory that is not already in use.

• In a multiuser environment, the Memory Manager sets up


a table to keep track of who using which section of
memory.
• Finally, when the time comes to reclaim the memory, the
Memory Manager de allocates memory.

• A primary responsibility of the Memory manager is to


protect the space in main memory occupied by the
operating system itself.

Input Output Device Manager


• The Device manager monitors every device, channel and
control unit. Its job is to choose the most efficient way to
allocate all of the system’s devices, printers, ports, disk
drives and so forth based on a scheduling policy chosen by
the system designers.

• The Device Manager does this by allocating the device,


making it available to the next process or job.

• I/O / Device module keeps track of the status of devices


(I/O traffic controller). Each I/O device has a device
handler that resides in a separate process associated with
that device.

22 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Networking Manager

Network Manager provides a convenient way for users to share


resources while controlling users’ access to them. These resources
include hardware (such as CPUs, memory areas, printers, tape
drives, modems, and disk drives) and software (such as compilers,
application programs, and data files.

File Manager
• The File Manager keeps track of every file in the system
including data files, program files, compilers and
application programs. By using predetermined access
policies, it enforces restrictions on who has access to which
files.

• The File Manager also controls what udders are allowed to


do with files once they access them. For example, a user
might have read-only access, read-and-write access, or the
authority to create and delete files. Managing access
control is a key part of file management.

• Finally, the File Manager allocates the necessary


resources and later de allocates them.

COOPERATION ISSUES
Each manager not only performs its individual tasks. It must also
be able to work harmoniously with every other manager. For
example, let’s say someone types a command to execute a
program.

The following major step must occur in sequence:

• The Device manager must receive the electrical impulses


from the keyboard, decode the keystrokes to form the
command, and send the command to the User Command
Interface, where the Processor Manager validates the
command.

23 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• The Processor Manager then sends an acknowledgement


message to be displayed on the video monitor so the user
realizes the command has been sent.

• When the Processor Manager receives the command, it


determines whether the program must be retrieved from
storage or is already in memory, and then notifies the
appropriate manager.

• If the program is in storage, the File Manager must


calculate its exact location on the disk and pass this
information to the Device manager, which retrieves the
program and sends it to the Memory Manager.

• The Memory Manager then finds space for it and records


its exact location in memory. Once the program in
memory, the Memory Manager must track its location in
memory (even it is moved) as well as it’s executed by the
Processor Manager.

• When the program has finished executing, it must send a


finished message to the Processor Manager so that the
processor can be assigned to the next program waiting in
line.

• Finally, the Processor Manager must forward the finished


message to the Device Manager, so that it can send a
message to the user.

No single manager could perform its task without the active


cooperation of every other part. They must corporate to succeed.

CHARACTERISTICS OF MODERN
OPERATING SYSTEM
Nowadays, there are four new characteristics in modern
operating system. These new characteristics are resulted from the
improvement and advancement of hardware’s technology
especially in CPU technology.

The four new characteristics are:

• Microkernel Architecture based operating System

24 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Multithreading Operating System


• SMP based Operating System
• Object-oriented Programming Language Operating
System

Microkernel Architecture Based Operating


System

Figure 2.2 Microkernel Architecture

A microkernel developed in the 1980s when the first usable local


area networks were being introduced. The main function is to
provide communication facility between the client program and
the various services that are also running in user spaces.

The other benefits of microkernel architecture are:

• New services added to user space and do not require


modification of Kernel.
• Provide more security and reliability.
• Commonly used in embedded applications.

25 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Allow user-space programs to to be worked on


monolithically and started and stopped like any other
program.
• Microkernel design imposes a uniform interface on
requests made by a process.
• It is flexible because features can be subtracted to produce
a smaller and more efficient architecture.
• Modular design helps to enhance reliability.
• It supports distributed operating system and object
oriented operating system.

Multithreading Processing
Threads is known as light weight process and used in
implementing network servers. Multithreaded applications
programs contain several threads running at one time that have
same or different priorities. Examples: Web browsers and time-
sharing systems.

A thread is contained inside a process. Thread of execution is the


smallest unit of processing that can be scheduled by an operating
system. Multiple threads can exist within the same process and
share resources such as memory. On a single processor,
multithreading generally occurs by time-division multiplexing (as
in multitasking): the processor switches between different
threads.

On a multiprocessor or multi-core system, the threads or tasks


will actually run at the same time, with each processor or core
running a particular thread or task.

Symmetric Multiprocessing Architecture


Based Operating System
Symmetric Multiprocessing (SMP) is a computer architecture
that provides fast performance by making multiple CPUs
available to complete individual processes simultaneously
(multiprocessing). Unlike asymmetrical processing, any idle
processor can be assigned any task, and additional CPUs can be
added to improve performance and handle increased loads.

26 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

With proper operating system support, SMP systems can easily


move tasks between processors to balance the workload efficient.
A variety of specialized operating systems and hardware
arrangements are available to support SMP. Specific applications
can benefit from SMP if the code allows multithreading.

SMP uses a single operating system and shares common memory


and disk input/output resources. Both UNIX and Windows NT
support SMP. Each CPU in an SMP system can act
independently. While one CPU handles a database lookup, others
can update the database and perform other tasks that can
increase the ability of the device.

Figure 2.2 Symmetric Multiprocessing Architecture

Object-Oriented Programming Language


Based Operating System

Object-Oriented Design

• Kernel
Resides in memory at all times, performs essential tasks,
and protected by hardware

• Kernel reorganization
Memory resident: only for few essential functions, such as
process scheduling and memory allocation
Modules: all other functions, such as device allocation, are
not allowed reside in main memory at all time.

27 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 2.3 Early and Object-Oriented OS

Advantages

Modification and customization can be done without disrupting


integrity of the remainder of the system so that software
development can be more productive.

28 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. Job Scheduler is a part of the _______

A. Processor Manager
B. Memory Manager
C. Networking Manager
D. File Manager

2. Which of the following provides a convenient way for


users to share resources while controlling user’s access?

A. Network Manager
B. Memory Manager
C. Processor Manager
D. File Manager

3. Which of the following statements are TRUE about


Microkernel operating system?

I. New services are added to user space and do not


require modification of kernel.
II. Provide more security but the system becomes less
reliable.
III. Secondary storage is limited/none
IV. Commonly used in embedded system

A. I, II and IV
B. II and IV
C. I and IV
D. I, II and III

4. Which of the following about Memory Manager is FALSE?

A. The Memory Manager allocates main memory


space to processes
B. The Memory Manager checks the validity of each
request for memory space
C. The Memory manager also needs to coordinate the
use of registers in the computer system
D. All of the above

29 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

5. An I/O Device Manager can do all the following


EXCEPT _______.

A. Update drivers
B. Check for viruses
C. Change peripheral I/O settings
D. Identify installed port

6. Which of the following is NOT a device manager


responsibility?

A. Maintain the information in the device status table


B. Loads the register within the device controller
C. Deallocates the device
D. Choose the most efficient way to allocate all the
system’s device

7. Essentials managers of an operating system work closely


together via _______.

A. User command interface


B. Graphical User Interface
C. Interprocess communication manager
D. Kernel interface

8. Which of the following provides a convenient way for users


to share resources why controlling user’s access?

A. Network manager
B. Memory manager
C. Processor manager
D. File manager

9. All the managers in operating system are invoked by


_______.

A. Device manager
B. Network manager
C. User interface
D. File manager

30 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

10. _______ provide an interface to the services made available


by an operating system.

A. System Call
B. Kernel
C. Command Interpreter
D. Parameter

31 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

THE FUNCTIONS AND


COMPONENTS OF
OPERATING SYSTEMS
Chapter 2

32 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

UNDERSTANDING OPERATING SYSTEM


COMPONENTS
Figure 2.1 show the five essential managers of every operating
system: the processor manager, the memory manager, the file
manager, the I/O or device manager and the network manager.
Each manager works closely with the other managers and
performs its unique role regardless of which specific operating
system is being discussed. At the top of pyramid is the User
Command Interface, from which users issue commands to the
operating system.

Regardless of size or configuration of the system, each of


subsystem managers shown in Figure 2.1 must perform the
following tasks:

1. Monitor its resources continuously


2. Enforce the policies that determine who gets what, when,
and how much
3. Allocate the resource when it’s appropriate
4. De-allocate the resource when appropriate

Figure 2.1 Operating System Managers

33 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

User Command Interface


There are two types of User Command Interface:

Command-Line Interface (CLI)

CLI is an interface that accepts line command. User has to write


a command, a line at a time. For example, some common
commands in UNIX are cd, cp and ls and some command in MS-
DOS are dir, copy and md.

Graphical User Interface (GUI)


GUI is an interface that allows the user to activate operating
system commands by clicking on desktop icons or menus using a
pointing device such as a mouse or touch pad and screen. Usually
GUI implemented in Macintosh and Windows.

Processor Manager
• The Processor Manager decides how to allocate the central
processing unit (CPU). An important function of the
Processor manager is to keep track of the status of each
process. A process defines as a program in execution.

• The Processor Manager monitors whether the CPU is


executing a process or waiting for a READ or WRITE
command to finish execution. Once the Processor Manager
allocates the processor, it sets up the necessary registers
and tables and, when the job is finished or the maximum
amount of time has expired, it reclaims the processor.

• The Processor Manager has two levels of responsibility.


One is to handle jobs as they enter the system and the
other is to manage each process within those jobs.

• The first part is handled by the Job Scheduler, the high-


level portion of the Process Manager, which accepts or
rejects the incoming jobs.

34 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• The second part is handled by the Process Scheduler, the


low-level portion of the Process Manager, which is
responsible for deciding which process gets the CPU and
for how long.

Memory Manager
• The Memory Manager is in charge of main memory, also
known as RAM (Random Access Memory).

• The Memory Manager checks the validity of each request


for memory space and, if it is legal request, it allocates a
portion of memory that is not already in use.

• In a multiuser environment, the Memory Manager sets up


a table to keep track of who using which section of
memory.
• Finally, when the time comes to reclaim the memory, the
Memory Manager de allocates memory.

• A primary responsibility of the Memory manager is to


protect the space in main memory occupied by the
operating system itself.

Input Output Device Manager


• The Device manager monitors every device, channel and
control unit. Its job is to choose the most efficient way to
allocate all of the system’s devices, printers, ports, disk
drives and so forth based on a scheduling policy chosen by
the system designers.

• The Device Manager does this by allocating the device,


making it available to the next process or job.

• I/O / Device module keeps track of the status of devices


(I/O traffic controller). Each I/O device has a device
handler that resides in a separate process associated with
that device.

35 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Networking Manager

Network Manager provides a convenient way for users to share


resources while controlling users’ access to them. These resources
include hardware (such as CPUs, memory areas, printers, tape
drives, modems, and disk drives) and software (such as compilers,
application programs, and data files.

File Manager
• The File Manager keeps track of every file in the system
including data files, program files, compilers and
application programs. By using predetermined access
policies, it enforces restrictions on who has access to which
files.

• The File Manager also controls what udders are allowed to


do with files once they access them. For example, a user
might have read-only access, read-and-write access, or the
authority to create and delete files. Managing access
control is a key part of file management.

• Finally, the File Manager allocates the necessary


resources and later de allocates them.

COOPERATION ISSUES
Each manager not only performs its individual tasks. It must also
be able to work harmoniously with every other manager. For
example, let’s say someone types a command to execute a
program.

The following major step must occur in sequence:

• The Device manager must receive the electrical impulses


from the keyboard, decode the keystrokes to form the
command, and send the command to the User Command
Interface, where the Processor Manager validates the
command.

36 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• The Processor Manager then sends an acknowledgement


message to be displayed on the video monitor so the user
realizes the command has been sent.

• When the Processor Manager receives the command, it


determines whether the program must be retrieved from
storage or is already in memory, and then notifies the
appropriate manager.

• If the program is in storage, the File Manager must


calculate its exact location on the disk and pass this
information to the Device manager, which retrieves the
program and sends it to the Memory Manager.

• The Memory Manager then finds space for it and records


its exact location in memory. Once the program in
memory, the Memory Manager must track its location in
memory (even it is moved) as well as it’s executed by the
Processor Manager.

• When the program has finished executing, it must send a


finished message to the Processor Manager so that the
processor can be assigned to the next program waiting in
line.

• Finally, the Processor Manager must forward the finished


message to the Device Manager, so that it can send a
message to the user.

No single manager could perform its task without the active


cooperation of every other part. They must corporate to succeed.

CHARACTERISTICS OF MODERN
OPERATING SYSTEM
Nowadays, there are four new characteristics in modern
operating system. These new characteristics are resulted from the
improvement and advancement of hardware’s technology
especially in CPU technology.

The four new characteristics are:

• Microkernel Architecture based operating System

37 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Multithreading Operating System


• SMP based Operating System
• Object-oriented Programming Language Operating
System

Microkernel Architecture Based Operating


System

Figure 2.2 Microkernel Architecture

A microkernel developed in the 1980s when the first usable local


area networks were being introduced. The main function is to
provide communication facility between the client program and
the various services that are also running in user spaces.

The other benefits of microkernel architecture are:

• New services added to user space and do not require


modification of Kernel.
• Provide more security and reliability.
• Commonly used in embedded applications.

38 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Allow user-space programs to to be worked on


monolithically and started and stopped like any other
program.
• Microkernel design imposes a uniform interface on
requests made by a process.
• It is flexible because features can be subtracted to produce
a smaller and more efficient architecture.
• Modular design helps to enhance reliability.
• It supports distributed operating system and object
oriented operating system.

Multithreading Processing
Threads is known as light weight process and used in
implementing network servers. Multithreaded applications
programs contain several threads running at one time that have
same or different priorities. Examples: Web browsers and time-
sharing systems.

A thread is contained inside a process. Thread of execution is the


smallest unit of processing that can be scheduled by an operating
system. Multiple threads can exist within the same process and
share resources such as memory. On a single processor,
multithreading generally occurs by time-division multiplexing (as
in multitasking): the processor switches between different
threads.

On a multiprocessor or multi-core system, the threads or tasks


will actually run at the same time, with each processor or core
running a particular thread or task.

Symmetric Multiprocessing Architecture


Based Operating System
Symmetric Multiprocessing (SMP) is a computer architecture
that provides fast performance by making multiple CPUs
available to complete individual processes simultaneously
(multiprocessing). Unlike asymmetrical processing, any idle
processor can be assigned any task, and additional CPUs can be
added to improve performance and handle increased loads.

39 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

With proper operating system support, SMP systems can easily


move tasks between processors to balance the workload efficient.
A variety of specialized operating systems and hardware
arrangements are available to support SMP. Specific applications
can benefit from SMP if the code allows multithreading.

SMP uses a single operating system and shares common memory


and disk input/output resources. Both UNIX and Windows NT
support SMP. Each CPU in an SMP system can act
independently. While one CPU handles a database lookup, others
can update the database and perform other tasks that can
increase the ability of the device.

Figure 2.2 Symmetric Multiprocessing Architecture

Object-Oriented Programming Language


Based Operating System

Object-Oriented Design

• Kernel
Resides in memory at all times, performs essential tasks,
and protected by hardware

• Kernel reorganization
Memory resident: only for few essential functions, such as
process scheduling and memory allocation
Modules: all other functions, such as device allocation, are
not allowed reside in main memory at all time.

40 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 2.3 Early and Object-Oriented OS

Advantages

Modification and customization can be done without disrupting


integrity of the remainder of the system so that software
development can be more productive.

41 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. Job Scheduler is a part of the _______

A. Processor Manager
B. Memory Manager
C. Networking Manager
D. File Manager

2. Which of the following provides a convenient way for


users to share resources while controlling user’s access?

A. Network Manager
B. Memory Manager
C. Processor Manager
D. File Manager

3. Which of the following statements are TRUE about


Microkernel operating system?

V. New services are added to user space and do not


require modification of kernel.
VI. Provide more security but the system becomes less
reliable.
VII. Secondary storage is limited/none
VIII. Commonly used in embedded system

A. I, II and IV
B. II and IV
C. I and IV
D. I, II and III

4. Which of the following about Memory Manager is FALSE?

A. The Memory Manager allocates main memory


space to processes
B. The Memory Manager checks the validity of each
request for memory space
C. The Memory manager also needs to coordinate the
use of registers in the computer system
D. All of the above

42 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

5. An I/O Device Manager can do all the following


EXCEPT _______.

A. Update drivers
B. Check for viruses
C. Change peripheral I/O settings
D. Identify installed port

6. Which of the following is NOT a device manager


responsibility?

A. Maintain the information in the device status table


B. Loads the register within the device controller
C. Deallocates the device
D. Choose the most efficient way to allocate all the
system’s device

7. Essentials managers of an operating system work closely


together via _______.

A. User command interface


B. Graphical User Interface
C. Interprocess communication manager
D. Kernel interface

8. Which of the following provides a convenient way for users


to share resources why controlling user’s access?

A. Network manager
B. Memory manager
C. Processor manager
D. File manager

9. All the managers in operating system are invoked by


_______.

A. Device manager
B. Network manager
C. User interface
D. File manager

43 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

10. _______ provide an interface to the services made available


by an operating system.

A. System Call
B. Kernel
C. Command Interpreter
D. Parameter

44 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

BOOTING CONCEPT
Chapter 3

45 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

BOOTING CONCEPT

Generally, booting is a process of starting or resetting/restarting


the computer. During the booting process the computer loads the
operating system to its memory and prepares it for use. Booting
process need a special program called Bootstrap Program or
Bootstrap Loader. Bootstrap loader locates the kernel, loads it
into main memory and starts its execution. General process could
be as follows:

• Read boot strap program from ROM


• Load the core OS into RAM
• Run a sequence of jobs in batch mode.
✓ DOS: CONFIG.SYS and AUTOEXEC.BAT.
✓ Windows: WIN.INI.
✓ MacOS: selected extensions.
✓ UNIX: .login, .profile , .cshrc.
• Start a graphical user interface (GUI).
• Waiting for input / interaction with the GUI.

Figure 3.1 OS Booting Concept

46 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Booting is required because hardware doesn’t know where the


operating system resides and how to load it. There are two types
of booting:

• Cold booting – starting computer that the power has


been off
• Warm booting - restarting computer that the power is
still on

SINGLE OS BOOTING PROCESS


In a single OS booting sequence, only a single OS is installed in a
partition. The first process starting when you turn on your
computer is runs Basic Input Output System (BIOS). BIOS
responsible for two functions:

Conduct POST (Power On Self-Test)

BIOS checks all the hardware devices connected to a computer


such as RAM and hard disk and make sure that the system can
run smoothly with hardware devices. If the POST is failure, the
system halts with a beep sound. Then BIOS checks the boot
priority.

Read MBR (Master Boot Record)

BIOS read and load the Master Boot Record (MBR) program into
memory (RAM). Now, MBR takes control of the booting process.

Figure 3.2 Master Boot Record

47 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

MBR is a small 512 bytes partition which is at the first physical


sector of the hard disk. The location is denoted as CHS 0,0,1
meaning 0th Cylinder, 0th Head and 1st Sector. MBR contains a
small program known as bootstrap loader @ bootstrap program
which is responsible for booting any OS. MBR also contains a
table known as partition table. Functions of MBR are:

1. The MBR looks over the partition table to find the


Bootable Partition @ Active Partition. Bootable
Partition @ Active Partition is that partition which is
flagged as bootable or which contains OS, this is generally
a Primary Partition.

2. MBR loads the content of Partition Boot Record (PBR) into


memory and transfers control to it to continue booting.
Partition/Volume Boot Record (PBR) is the logical
first sector, a sector that is at the start of a Primary
Partition. This is also 512 byte area, which contains some
programs to initialize or run OS files. All Primary
Partitions have its own PBRs.

3. The PBR locates the system-specific boot files (such as


Win98's io.sys or WinXP’s ntoskrnl).

4. Then these boot files continue the process of loading and


initializing the rest of the operating system.

DOS Booting Process


When DOS was first used by IBM for its personal computers, the
OS was called PC-DOS, and IBM gave certain names to the files
that made them sound like IBM-specific files. But as soon as
clone-makers (e.g. Compaq, Dell) starting making IBM-
compatible clone computers, Microsoft released a clone version
called MS-DOS, and renamed some of those files. Now MS-DOS is
much more widely used than PC-DOS, and MS-DOS names are
more common. For DOS systems, the MBR will point the
computer to two hidden start-up files. The first of these files is
IO.SYS (or for IBM computers, IBMBIO.COM). This must be the
very first file (physically) on your boot disk or your disk will not
boot.

48 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

The second file is called MSDOS.SYS (or IBMDOS.COM for IBM


computers). This must be the second file (physically) on the boot
disk or it will not boot. This is why you cannot create a boot disk
by simply copying these files to blank floppy disk. They would be
on the disk, but they would not be in the proper position for the
boot process to find them. To create a “system disk”, you need to
use a particular command that tells the computer to place these
files in the precise position needed for booting to occur.

DOS Booting Sequence

1. The first file to be loaded is IO.SYS file. IO.SYS (or


IBMBIO.COM) contains the interface between MS-DOS
(or PC-DOS) and the I/O subsystem. This allows the OS to
communicate with the basic peripherals and perform input
and output tasks.

2. The second file to be loaded is MSDOS.SYS. MSDOS.SYS


(or IBMDOS.COM) is the Kernel of the OS. It interacts
with the hardware and helps process the various DOS
functions.

Both IO.SYS and MSDOS.SYS are hidden files, which


mean that ordinarily you would not be aware of them, and
they would not appear in a directory listing. This is to
protect the OS from someone mistakenly deleting these
key files and rendering the computer unable to boot.

3. The third file to be loaded is CONFIG.SYS. As the name


implies, this file contains information that helps to
configure your system.

This is where you would install devices and drivers, for


instance. In DOS, it is common to have your mouse, sound
card, and CD-ROM drive installed here, as well as certain
memory management and other functions. If there is no
CONFIG.SYS file present, a default version contained
within MSDOS.SYS is loaded.

49 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

4. The fourth file to be loaded, which is automatically added


to the disk when you make a system disk, is
COMMAND.COM.

This file does not need to be in any particular physical


location on the disk, but does need to be in the root
directory. This file is a command interpreter, which means
that it can interpret the commands you issue. Every OS
has some type of command interpreter, though they may
use a different name. COMMAND.COM interprets all of
the Internal Commands.

5. The fifth and last file to be loaded is AUTOEXEC.BAT.


This is a batch file, which means that it contains a series
of commands that are executed whenever the file is run.

This file is “automatically executed” when you boot, hence


the name. If there is no AUTOEXEC.BAT file present, a
default version is run. You can usually tell because if the
default version is run you will be asked to enter the date
and the time.

After all of this, if it all works correctly, you will finally see the
prompt, which will most likely look like one of these: A:\> or
C:\>. The summary of DOS boot sequence can be described as
follows:

1. POST
2. MBR
3. IO.SYS
4. MSDOS.SYS
5. CONFIG.SYS
6. COMMAND.COM
7. AUTOEXEC.BAT
8. Command prompt

Windows Booting Sequence


There are five major sequences that occur during Windows (e.g.
Windows XP Professional) booting process:

50 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Pre-Boot Sequence
It begins when the power is turned on. The computer performs
self-check routines and locates a boot record.

• BIOS conduct POST (Power On Self Test) test memory


and subsystems. Systems run POST for any devices.
• BIOS read the MBR. MBR takes over means that
Windows is now in control. MBR looks NTLDR at the
BOOT SECTOR.

Boot Sequence
Hardware configuration is detected and loaded.

• NTLDR is the boot loader for Windows XP.


• Allow memory addressing.
• Initiate the file system.
• Read the BOOT.INI
• Load the boot menu.

Kernel Load Sequence


Operating Systems components are loaded into memory. Once XP
selected from the Boot Menu, NTLDR run:

• NTDETECT.COM
• BOOT.INI
• NTBOOTDD.SYS
• Load NTOSKRNL.EXE and HAL.DLL which is located in
%SystemRoot%System32.
• Read the registry, choose hardware profile and authorize
device driver.

Kernel Initiation Sequence


Windows XP Professional kernel takes control of the system.

• NTOSKRNL.EXE takes over

51 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Log On Sequence

When the Log On to Windows dialog box is displayed and users


can log on.

• WINLOGON.EXE starts.
• LSASS.EXE starts and display Logon screen.

Figure 3.3 Windows Booting Sequence

Linux Booting Sequence


There are six sequences in Linux booting process:

1. Boot Loader (Kernel Loader) finds the kernel image on the


disk and loads it into memory. Kernel image is the management
of the system’s resources and the software components like
process management, memory management, device management
and system call. GRUB (Grand Unified Bootloader) and LILO
(Linux Loader) are the most popular Linux boot loader.

52 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 3.4 Linux Booting Sequence

2. The kernel initializes the device and its drivers.

3. The kernel mounts the root file system.

4. The kernel starts a program called init. Init is the


root/parent of all processes executing on Linux. The main
purpose of init is to start and stop other program in a
particular sequence.

5. Init sets the rest of the processes in motion.

6. The last processes that init starts as part of the boot


sequence allow user to log in.

MULTIPLE OS BOOTING PROCESS


Multiple OS booting process also called as dual booting process.
This type of booting implemented in a computer which is installed
multiple OS and being able to choose which one to boot when
switching on the computer.

53 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

There are two different types of booting process in multiple OS


environment:

• Microsoft Windows way


• Non-Microsoft Windows way

Figure 3.5 Non-Microsoft Windows Way

Figure 3.6 Microsoft Windows Way

54 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. The event when power to a computer is cycled or a
special reset signal to the processor is triggered is
called _______.

A. Cold Boot
B. Warm Boot
C. BIOS Boot
D. Start Boot

2. Which of the foollwing is TRUE about BIOS?

A. Waiting for intterupt or event


B. Locates MBR
C. Inititae file system
D. Manage the I/O

3. Which one of the following statement is NOT true about


NTLDR in Windows XP?

A. Allow memory addressing


B. Initiate the file system
C. Read the BOOT.INI
D. Test memory and subsystems

4. One of the purposes of ___________ file in DOS booting


process is to load device drivers.

A. IO.SYS
B. CONFIG.SYS
C. COMMAND.COM
D. AUTOEXEC.BAT

5. Which of the following is NOT a task performed by the


computer's BIOS?

A. starts the OS
B. enables communications with devices
C. manages random access memory
D. performs the power on self-test

6. A computer will NOT ‘Boot’ if it does not have the _______.

55 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

A. compiler
B. bootstrap loader
C. compiler
D. system call

7. Which is the following is an essential file of a MS-DOS


boot disk?

A. COMMAND.COM
B. NTDETECT.COM
C. BOOT.COM
D. WINLOGON.COM

8. Select one of the files that will NOT be executed by the


NTLDR?

A. BOOT.INI
B. LSASS.EXE
C. NTDETECT.COM
D. NTBOOTDD.SYS

9. In DOS booting sequence, all of the following files are


included EXCEPT _______.

A. IO.SYS
B. NTDETECT.COM
C. CONFIG.SYS
D. AUTOEXEC.BAT

10. _______ is a special type of boot sector at the very


beginning of partitioned computer mass storage devices
like fixed disks or removable drives intended for use with
IBM PC-compatible systems and beyond.

A. Boostrap
B. MBR
C. GRUB
D. BIOS

56 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

USER INTERFACE
Chapter 4

57 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
User interface is a program or set of programs that sits as a layer
above the operating system itself. User interface provide the way
a person or a user interacts with a computer or electronic device.

User interface brings structure to the interaction between a user


and the computer. It helps the user use the computer system
productively. User interface also provide consistent user interface
services to application programs to lower learning curves and
increase productivity. Choice of user interface depends on the
kind of user–writing programs versus running applications.

The core operating system functions lie in the kernel of operating


system. The user interface is separate, though it may be tied
tightly to the kernel beneath.

Figure 4.1 User Interface

58 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Nowadays there are several types of user interface:

• Command-Line User Interface (CLI)


• Graphical User Interface (GUI)
• Natural User Interface (NLI)

COMMAND LINE USER INTERACE (CLI)

A Command-Line Interface (CLI) is a mechanism for interacting


with a computer operating system or software by typing
commands to perform specific tasks.

This method of instructing a computer to perform a given task is


referred to as "entering" a text command by pressing the "Enter"
key. A CLI interpreter then receives, analyses, and executes the
requested command. The general pattern of command-line
interface is:

prompt command pr-1 pr-2 pr-3 ........ pr-n

• prompt or > is generated by the program to provide


context to the client
• command is provided by the client.
• pr-1 ... pr-n are optional parameters provided by the client

Figure 4.2 Command Prompt

59 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

UNIX Architecture

In a CLI, user can issue commands to a program in the form of


successive lines of text. If users allow to issues command using
only a text, it is called text-based user interface. The CLI, for
example UNIX, is usually implemented with a command line
called shell.

Figure 4.1 UNIX Architecture

There are four basic features in UNIX Architecture: Hardware,


Kernel, Shell and Browser.

The Shell
The Shell is a program that accepts commands as text input and
converts commands to appropriate operating system functions.
The shell is the user interface with the Unix system, the
middleman between user and the kernel. The shell displays a
"prompt," to notify user that it is ready to accept command. The
shell is a program that the Unix kernel runs for user. A program
is referred to as a process while the kernel is running it.

60 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

In UNIX, there are two major types of shells:

• The Bourne shell – the default prompt is the $ character.


• The C shell – the default prompt is the % character.

Today command-line interfaces are less widely used but it still


often preferred by more advanced computer users. Examples are
UNIX and MS-DOS.

GRAPHICAL USER INTERFACE (GUI)


Most modern operating systems, like Windows and the Macintosh
operating system provide a graphical user interface (GUI). A GUI
lets user control the system by using a mouse to click graphical
objects on screen. Graphical objects called icons appear on a
background (the desktop), representing resources you can use.

Figure 4.3 Windows 98 GUI

61 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Icons
Icons are pictures that represent computer resources, such as
files, printers and programs. Users have to double-click an icon to
choose (activate) it, for instance, to launch a program. The
Windows operating system offers two unique tools, called the
Taskbar and Start button. These help you run and manage
programs.

Windows

Applications designed to run under one operating system use


similar interface elements. In GUI, each program opens and runs
in a separate window. Window is a frame that presents the
program and its documents. User can run multiple programs at
once, each in a separate window. The application in use is said to
be the active window.

Figure 4. 4 Window

62 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Menus

In GUI, users are allowed to issue commands by choosing them


from menus. A menu groups related commands. For example, the
File menu's commands let you open, save, and print document
files. Menus let you avoid memorizing and typing command
names. In programs designed for the same GUI, menus and
commands are similar from one program to another.

Figure 4.5 Menu in Word Perfect 9

63 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

NATURAL LANGUAGE INTERFACE (NLI)

Natural language interface (NLI) provides verbal commands


given to computer. NLI utilizes such natural language processing
element as voice recognition, voice data entry and voice response.
Keyboards, pointing devices and microphones are the primary
input devices and speakers provide audio output. Natural
language processing requires a powerful computer with a great
deal of memory and a fast processor. It can be observed in
multimedia applications and online games.

The advantages of NLI are:

• Very easy for novice users


• Quick
• Hands free (can be used by people with disabilities)

The disadvantages of NLI are:

• Can be unreliable
• Can “interpret” incorrectly (dialect)

GUI VERSUS CLI

UI Advantages Disadvantages
• More flexible and • More difficult to learn and
powerful use
• Faster for
CLI experienced users
• Can combine
commands
• Less memory used
• Easy to learn and • Harder to implement
use • More HW/SW
• Little training requirements
GUI
• Suitable to multi- • Requires lots of memory
tasking • SW is complex and
difficult to write

Table 4.1 GUI versus CLI

64 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

USER INTERFACE IN REVIEW

Disk Operating System (DOS)


DOS dominated the operating system market during the 1980s.
DOS is a single-user OS that supports only 640 KB of memory.
DOS features a command-line interface, and does not support
multitasking or multiprocessing. Because DOS provides no
interface restrictions, DOS applications can look and function
differently

UNIX
UNIX is the oldest operating system used on PCs. UNIX was the
first multi-user, multiprocessor, multitasking operating system
available for use on PCs. Most versions of UNIX use a command-
line interface, but some versions offer a GUI.

Mac OS
The Macintosh OS supports the graphical nature of the
Macintosh computer. The Mac OS brought the first truly
graphical user interface to consumers. The Mac OS also brought
interface conformity to the desktop. All applications running
under the Mac OS, therefore, provided the same "look and feel" to
the user.

Windows 3.x
Windows 3.0, 3.1, and 3.11 are called the Windows 3.x family.
Windows 3.x brought a GUI and multitasking capabilities to PCs
running DOS. Windows 3.x is an operating environment because
it ran on top of DOS, which was the actual OS.

OS 2/Wrap
OS/2 Warp was the first true GUI-based operating system for
Intel-based PCs. OS/2 is a multitasking OS that provides support
for networking and multiple users. It was the first PC OS to
feature built-in speech recognition capabilities.

65 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Linux
Linux is a recently developed version of UNIX, which is available
for free or at a very low cost from various sources. Linux is a very
powerful 32-bit OS that supports multitasking, multiple users,
networking, and virtually any application. Linux can run on
nearly any type of computer. Because of its power and openness,
Linux is attracting many users, including students, teachers,
Internet service providers, and others.

Windows 2000
Windows 2000 features the same interface and features of
Windows 98, with the file system, networking, power, and
stability of Windows NT. Several versions of Windows 2000 are
available, each targeting a specific user or computing
environment, from home PCs to large enterprise networks.

66 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. Why the CLI uses less resource compared to GUI?

A. It is easier to use
B. It is easier to memorize
C. Have windows
D. No need to install a graphical layer

2. Which of the following is the characteristic of GUI?

A. More flexible and powerful


B. Faster for experienced users
C. Can combined commands
D. Mouse –driven and icon-based

3. ______ features in GUI is better than CLI.

A. Multitasking
B. Speed
C. Control
D. Resources

4. Which of the following is NOT an advantage of


Graphical User Interface (GUI)?

A. GUI is more user friendly


B. GUI is easier to understand and learn than CLI
C. GUI users have windows that enable a user to
easily view and control
D. GUI offers the users much more control and
options on their system

5. Natural language user interface can accept input in the


form of _______.

A. string command
B. speech
C. image
D. animation

67 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

6. In MS-DOS command-line interface, mkdir is a command to


_______.

A. create directory
B. copy a file
C. delete directory
D. rename directory

7. GUI requires more system resources as compare to CLI


because _______.

A. icon to be loaded
B. script to be used
C. prompt interface
D. command to be wrote

8. “Memorizing and familiarity is needed and users have much


more control of their file system and operating system”.
The above statement refers to _______.

A. Graphical user interface


B. Menu driven interface
C. Command line interface
D. Natural language interface

9. Command line interface needs a _______.

A. compiler
B. prompt
C. icon
D. mouse

10. Which of the following is NOT TRUE regarding MS-DOS


command?

A. CHKDSK - checks for problems and repairs


corrupted disks.
B. MKDIR – makes a directory on the disk.
C. XCOPY – copies files or entire directories with their
subdirectories.
D. TYPE – change the MS-DOS command prompt
from C:> to whatever you wish

68 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

FILE SYSTEM
Chapter 5

69 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
The file management functions or called as the file system
incorporates routines that allow the user or programmer to
create, delete, modify and manipulate files logically by name.
There are two distinct parts of a file system, the mechanism for
storing files and the directory structure into which they are
organized. The file system helps keep track of the data and
programs stored on disk and other secondary storage devices. The
location of every file stored on a disk can be found by searching
the disk’s directory. The file system manages the directory. A file
system is a clearly-defined method that the computer's operating
system uses to store, record and retrieve files.

Figure 5.1 Process Cooperation

FILE SYSTEM CONCEPT

A file is a collection of (binary, numeric or character) data. A file


could represent a program, a document or in some cases part of
the file system itself. File can be stored on various storage media.
OS provides a uniform logical view of information storage. OS
abstracts from the physical properties of its storage devices to
define a logical storage unit, FILE.

70 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Files are mapped by the OS onto physical devices. All files have a
name by which they can be accessed by the user. In most modern
file systems the name consists of three parts, its unique name, a
period and an extension. File systems resides permanently on
secondary storage.

File Structure

A typical file system consists of:

• Collection of Files – file contains related data.


• Metadata (Directory Structure) – organizes & provides
information about all files in the system.
• Partitions – separates physically or logically large
collections of directories.

Figure 5.2 Typical File System

71 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

File Attributes

File attributes vary from one operating system to another. The


common file attributes are name, identifier, type, location, size,
protection, time, and date and user identification.

• Name – only information kept in human-readable form.


• Identifier – unique tag (number) identifies file within file
system.
• Type – needed for systems that support different types.
• Location – pointer to file location on device.
• Size – current file size.
• Protection – controls who can do reading, writing,
executing.
• Time, date and user identification – data for
protection, security and usage monitoring.

Figure 5.3 UNIX File Attribute

File Operation

There are six different operations that can be performed on a file.


The operating system provides system calls to create, write, read,
reposition (seek), delete, and truncate files. These operations are
described below:

Creating a file
For creating a file, address space in the file system is required.
After creating, entry of the file is made in the directory. The
directory entry records the name of the file and the location in the
file system.

Writing to a file

72 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

System call is used for writing into file. It is required to specify


the name of the file and information to be written to the file.
According to the file name, system will search the name in the
directory to find the location of the file.

Reading from a file


To read a file, system call is used. It requires the name of the file
and memory address. Directory is searched for the associated
directory entry and the system needs to keep a read pointer to the
location in the file where the next read is to take place.

Repositioning within a file


The directory is searched for the appropriate entry and the
current file position is set to a given value. Repositioning within a
file does not involve an actual I/O. This file operation is also
known as file seeks.

Deleting a file
System will search the directory of which file to be deleted. If
directory entry is found, it releases all file space. That free space
can be reused by another file.

Truncating a file
User may want to erase contents of file but keep its attributes.
Rather than forcing the user to delete a file and then recreate it,
truncating functions allows all attributes to remain unchanged
except for file length.

File Types

A file has a certain defined structure according to its type. Name


of the file is split into two parts: a name and an extension.
Following table gives the file type with usual extension and
function.

73 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 5.4 File Operation

Table 5.1 File Types

74 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

FILE ACCESS METHOD


File system has a method for storing and organizing computer
files and the data they contain to make it easy to find and access
them. An access method describes the manner and mechanism by
which a process accesses the data in a file. There are two common
access methods: sequential access and direct access.

Sequential Access

The simplest access method is sequential access. Information in


the file is processed in order, one record after the other. The file is
read or written sequentially starting at the beginning of the file
and moving to the end. OS uses the address of the last byte read
to access the next sequential record. Therefore, the current byte
address (CBA) must be updated every time a record is accessed.

Figure 5.5 Sequential Access Method

Direct Access

Direct access allows random access to any file block. This method
is based on a disk model of a file. It allows programs to reads and
writes records rapidly in no particular order. These methods
generally involve the construction of an index for the file.

Figure 5.6 Direct Access Method

75 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

DIRECTORY STRUCTURE

All modern operating systems have adopted the hierarchical


directory model to represent collections of files. A directory itself
contains information about the files including attributes, location
and ownership. OS manage this type of information.

Figure 5.7 File Directory Structure

The types of operations that may be performed on the directory


are:

Search
Directory structure is searched for finding particular file in the
directory. File has symbolic names and similar names may
indicate a relationship between files.

Create a file
When a new file is created, an entry must be added to the
directory.

Delete a file
When a file is deleted, an entry must be removed from the
directory.

Rename a file

76 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Name of the files must be changeable when the content or


use of the file changes. Renaming a file may also allow its
position within the directory structure to be changed.

List directory
All or portion of the directory may be requested. Request is
made by a user and result in a listing of all files owned by
that user plus some of the attributes of each file.

Single Level Directory


Single level directory is simple directory structure. All files are
contained in the same directory. Disadvantages – not suitable for
a large number of files and more than one user and file require
unique file name.

Figure 5.8 Single Level Directory

Two-Level Directory
In two-level directory, each user has his owns directory. It is
called User File Directory (UFD).Each user file directory has a
similar structure. Different users may have files with the same
name, as long as all the files named within each UFD are unique.
OS cannot accidently delete another user file that has the same
name because OS must confines the search to the local UFD.

77 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 5.9 Two-Level Directory

Tree Structured Directory


MS-DOS is a tree structure directory. It allows users to create
their own subdirectory and to organize their files accordingly. A
subdirectory contains a set of files or subdirectories.

Figure 5.10 Tree Structured Directory

The UNIX file system is laid out as a hierarchical tree structure


which is anchored at a special top-level directory known as the
root. Because of the tree structure, a directory can have many
child directories, but only one parent directory.

78 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 5.11 UNIX File System

Acyclic Graph Directory

This directory allows directories to have shared subdirectories


and files. Same file or directory may be in two different
directories. Shared files and subdirectories can be implemented
by using links. An acyclic graph directory structure is more
flexible than is a simple tree structure but sometimes it is more
complex.

Figure 5.12 Acyclic Graph Directory

79 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

FILE SYSTEM MOUNTING


File system must be mounted before it can be available to
processes on the system. Multiple file system trees can be
mounted together. Procedure mounting file system as follows:

• OS is given the name of the device and the location within


the file structure at which to attach the file system (called
‘mount point’).
• OS verifies that the device contains a valid file system
(ask device driver to read the device directory and verify
that the directory has the expected format).
• OS notes in its directory structure that a file system is
mounted at the specified mount point.

Figure 5.13 File System Mounting

FILE SHARING

Sharing of files on multi-user systems is desirable. On distributed


systems, files may be shared across a network. Network File
System (NFS) is a common distributed file-sharing method. The
system can either allow a user to access the files of other users by
default or it may require that a user specifically grant access to
the files.

80 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Most systems have evolved to the concept of file directory owner


and group. The owner is the user who may change attributes,
grant access and has the most control over the file or directory.

FILE PROTECTION

Protection mechanism provides controlled access by limiting the


type of file access that can be made. Access permitted or denied
depending on several factors, one of which the type of access
required. Different types of operations may be controlled in access
type.

The different types of access are read, write, execute, append,


delete and list.

Access Control

Generally there are three types of user: owner, , group and


others:

• Owner – user who created the file


• Group – set of users
• Others - all other users in the system

Figure 5.14 UNIX Access Control

Users usually have three modes of access: read, write, execute


• Owner access → 7 rwx (111)
• Group access → 5 r−x (101)
• Public/other access → 5 r−x (101)

81 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

FILE ALLOCATION METHOD

File viewed as a contiguous sequence of bytes. Allocation process


is actually storing the bytes. There are three types of file
allocation:

• Contiguous Allocation
• Linked Allocation
• Indexed Allocation

Contiguous Allocation

In contiguous allocation, each file occupies a set of contiguous


blocks on the disk.

Advantages
Simple – only starting location (block number) and length
(number of blocks) are required.
Random access

Disadvantages
Wasteful of space (dynamic storage-allocation problem)
Files cannot grow

Figure 5.15 Contiguous Allocation

82 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Linked Allocation

In linked allocation, each file is a linked list of disk blocks: blocks


may be scattered anywhere on the disk. Directory contains a
pointer to the first and last blocks of the file. For example, in
Figure 5.16, file starts at block 9.

Figure 5.16 Linked Allocation

Indexed Allocation

Indexed allocation brings all pointers together into the index


block. It needs index table in this method. Access method is
random access without external fragmentation, but have
overhead of index block.

Figure 5.17 Indexed Allocation

83 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Table 5.2 Allocation Types Comparison

FILE TECHNOLOGY

There are several file technology supported by operating system


to the users. Different operating system support different types of
file technology. The popular file technology used today are
FAT16, FAT32 and NFTS.

OPERATING FILE TECHNOLOGY


SYSTEM SUPPORTED
MS-DOS, windows 95 FAT16

Windows 95, 98, Me FAT16, FAT32


Windows NT, 2000,
FAT16, FAT32, NFTS
XP
Linux FAT16, FAT32, Ext2

Table 5.3 File Technology

File Allocation Table (FAT)

The File Allocation Table (FAT) filing system, supported by all


versions of Microsoft Windows, was an evolution of that used in
Microsoft's earlier operating system (MS-DOS). FAT (File
Allocation Table) refers to a data table that holds information
about how and where files are stored on any one partition which a
single storage device may have one or several partitions.

84 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

FAT16 is a file system used in the first releases of Windows 95.


FAT32 is a file system used by later releases of Windows 95 and
by Windows 98/98 SE. FAT32 also supported by Windows XP,
Windows Vista and Windows 7. FAT 64 support Windows 2003,
Windows Vista, Windows 2008, Windows 7 and Win XP.

In FAT data structure or table used to keep track of the portions


assigned to a file.

NTFS (Windows File System)

Network File System (NFS) is a common distributed file-sharing


method. NTFS was intended to meet high-end applications for
workstations and servers. Example of high-end applications
includes the following:

• Client-server applications such as file servers, compute


servers and database servers.
• Resource-intensive engineering and scientific applications.
• Network applications for large corporate systems.

NTFS is more powerful than FAT32 with improved access speed,


performance, reliability, fault tolerance, recoverability,
complicity, security, as well as support for long file names, large
volumes. NTFS is the primary file system used in Microsoft's
Windows 7, Windows Vista, Windows XP, Windows 2000 and
Windows NT operating systems. The Windows Server line of
operating systems primarily uses NTFS.

Advantages of NTFS over FAT include faster access to files, more


efficient information storage , better data recovery, integrated file
compression, larger disk partitions, and better file security

EXT (Extended File system)

It was designed by the Linux community and consists of three


versions: EXT2, EXT3 and EXT4. It was implemented in the first
versions of Linux - Minix file system.

85 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

The design is based on UNIX-like structures (BSD) with many


optimizations for speed and new features. Like JFS (Journaled
File System) and other Unix derivates, there is no redundant
filename info in the Inodes, making file recovery much more
difficult. It provides safer data and fast reboots and also improves
data integrity and recovery, especially after unclean system
shutdowns. EXT3 adds a journaling file to EXT2.

Directories are ordinary files, containing a mapping between


filenames and Inodes. There can be more than one directory entry
pointing to the SAME Inode. The Inode contains file attributes
including ownership and a lists of allocated blocks.

• 12 direct blocks, for files of up to 12 blocks


• Indirect, double indirect and triple-indirected blocks

86 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. What is the function of executable file?

A. Ready-to-run machine language program


B. Libraries of routines for programmer
C. Related files grouped into one file
D. Textual data

2. A file system must be _______ before it can be accessed.

A. formatted
B. mounted
C. backed up
D. initialized

3. What is the file allocation method for the following


diagram?

A. Contiguous Allocation
B. Linked Allocation
C. Indexed Allocation
D. Linked List

87 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

4. Which of the following file extensions is used for libraries


of routines in the system?

A. avi
B. exe
C. dll
D. rar

5. “The directory structure allows users to create their


own subdirectory and to organize their files
accordingly. Sharing of files and subdirectories are
implemented by using links.”

The above statement refers to the _______ directory


structure.

A. Single-level
B. Two-level
C. Tree-structured
D. Acyclic graph

6. “Blocks may be scattered anywhere on the disk. All the


pointers are pointed to one location”.

The above statements refers to _______.

A. Indexed allocation
B. Linked allocation
C. Contiguous allocation
D. Random allocation

7. The typical file system consists of the following EXCEPT


_______.

A. collection of files
B. metadata
C. partitions
D. user identifications

88 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

8. Which of the following operating system does NOT use


NTFS file system?

A. Windows XP
B. Windows Vista
C. Windows 10
D. Windows 7

9. The permission granted for command of chmod 761 of a file


name CSC204.TXT is _______.

A. d rwx rw- --x


B. - rwx rw- --x
C. - rwx r-x -rx
D. d rx- r-- -r-

10. Which of the following file system does MS-DOS commonly


use?

A. FAT16
B. FAT32
C. FAT64
D. NTFS

89 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

DEVICE DRIVER
Chapter 6

90 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

DEVICE MANAGEMENT
An application process uses a device by issuing commands and
exchanging data with the device management. Device
management is the part of the OS that manages hardware
devices through device manager.

The functions of device management are:

• provides a uniform interface to ease the access to devices


with different physical characteristics
• optimizes the performance of individual devices

Figure 6.1 Device Management Organization

Device manager monitors every device, channel and control unit.


Its responsibility includes:

• Choose the most efficient way to allocate all of the


system’s device, printers, terminals, disk drives.
• Makes the allocation starts its operation
• Deallocates the device

91 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

DEVICE DRIVER

What is Device Driver

Device driver is device-specific code to control an I/O device, is


usually written by device's manufacturer. It is a piece of software
that extends a kernel’s functionality.

A device driver is usually a part of the operating system kernel in


which compiled with the OS and dynamically loaded into the OS
during execution. But anyway it can be separated from OS
because of new functions can be added to the driver without
requiring the OS to be modified, recompiled and redistributed.

Figure 6.2 Simple Device Driver Model

There is a device driver for each type of device that is attached to


the system. Thus, it is usually necessary to install a new device
driver in the computer after attaching new device hardware. It
provides an application programming interface to a device. It
abstracts the details of controlling a device into a set of functions
that can be called from application programs. It is often (but, not
always) in conjunction with the device’s controller.

92 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

If the device uses interrupts, the device driver will suspend after
starting the device, knowing that the corresponding interrupt
handler will take up the interaction with the device when it
raises an interrupt signaling that the I/O operation has
completed.

Device drivers manage the complexity and differences among


specific types of devices (disk, mouse). It manages queues and
buffers (special storage holds stream of bits from device and sent
them to the CPU).

Normally each device driver handles:

• One device type (for example, mouse)


• One class of closely related devices (for example, SCSI disk
driver to handle multiple disks of different sizes and
different speeds.).

Device Driver Responsibilities


The following are the responsibilities of device driver:

• Initialize the devices.


• Interpreting the command from OS.
• Schedule multiple outstanding requests (I/O Write/Read).
• Manage data transfer from/to device to/from memory/CPU.
• Accept and process interrupts.
• Check the devices status (READY/ NOT READY).
• Control the device to allow modification of its attributes.

Types of Device Driver

Character Device Interfaces


The features of character device interfaces are:

• Sequential access.
• Accessed via streams of bytes.
• No buffering.
• Examples: Keyboard, printers and soundcard.

93 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Block Device Interfaces


The features of block device interfaces are:

• Random access.
• Need Buffering.
• Everything that can hold a file system.
• Examples: Floppy, hard disk and CD-ROM.

Network Device Interfaces


The features of network interfaces are:

• Able to exchange data with other hosts.


• Sending and receiving data packets, driven by the network
subsystem of the kernel
• Designed around the transmission and receipt of packets.
• USB Ethernet interface

Device Driver Overview


Generally, the main function of device driver are:

• It manages the complexity and differences among specific


types of devices (disk, mouse).
• It manages queues and buffers (special storage holds
stream of bits from device and sent them to the CPU).

94 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 6.3 Device Driver Overview

DEVICE CONTROLLER
Device controller is a hardware component that adapts a generic
device so that it can operate with a particular computer.

Figure 6.4 Device Controller

The functions of device controller are:

95 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Provides a standard interface to the device hardware so


that the OS device driver software will be able to interact
with the device.
• Moves data between the peripheral device it controls and
its local buffer storage.

Device controller consists of three registers:

Command Register
The device controller contains a command register to which the
device driver can write device commands to start an operation on
the device.

Status Register
The device controller have a status register that the device
driver can read device status to determine if the I/O operation
completed successfully, or if the most recent device operation
resulted in an error, the status register will report the nature of
the error.

Data Register
The device controller also typically contains one or more data
registers where data that is to be written to the device is store
before starting the write operation, or where the result of a read
operation is retrieved when the device finishes the read
operation.

Since each device controller is specific to a particular device, the


device driver implementation will be device specific to:

• Provide correct commands to the controller.


• Interpret the controller status register (CSR) correctly.
• Transfer data to and from device controller data registers
as required for correct device operation.

The following is an example of transfer data from device to


CPU:

96 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

✓ CPU interrogates I/O controller to check status of I/O


devices.
✓ I/O controller returns the device status.
✓ If device is READY then CPU request the transfer of data,
send a command to I/O module.
✓ I/O controller obtains the data.
✓ Data is transferred from I/O controller to CPU

DEVICE DRIVER INTERFACE

Each operating system defines the architecture for its device


management system. The designs are different from operating
system to operating system; there is no universal organization.
Each operating system has two major interfaces to the device
manager:

• The driver API


• The interface between a driver and the operating system
kernel

Driver API Interface


The device driver API provides a set of functions that an
programmer can call to manage a device (usually communications
or storage).

The device manager:

• Must track the state of the device: when it is idle, when is


being used and by which process
• Must maintain the information in the device status table
• May maintain a device descriptor to store other
information about the device

In POSIX systems, each device driver has at least the following


functions and usually some additional functions such as open ( ),
close ( ), read ( ), write ( ), lseek ( ) and ioctl ( ). An application
program can make a system call on one of these function names.
The operating system will ultimately run the corresponding
function in the device driver of the corresponding device

97 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

The open/close functions allow initiate/terminate of the device’s


use. The details are:

• Open () – allocates the device and initializes the tables and


the device for use.
• Close () – releases dynamic tables entries and releases the
device.

The read/write functions allow the programmer to read/write


from/to the device such as:
• character devices or block devices
• sequential devices or randomly accessed devices

The ioctl function allows programmers to implement device


specific functions.

The device driver API must execute privileged instructions when


it starts the device; this means that the device driver must be
executed as part of the operating system rather than part of a
user program. The device driver API must also be able to
read/write info from/to the address spaces of different processes,
since same device driver can be used by different processes.

Driver-Kernel Interface

This is the device-specific code in the kernel interacts directly


with the device hardware.

The functions of driver-kernel interface are:

• Supports a standard and internal interface.


• Same kernel I/O system can interact easily with different
device drivers.
• Special device-specific configuration supported with the
ioctl () system call.

98 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 6.5 Device Driver Interface

99 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. Device driver gives an instruction to devices to perform
the operation. Which of the following registers will be
used?

A. Data register
B. Command register
C. Status register
D. DMA register

2. Which of the following is responsible for moving data


between the peripheral device it controls and its local
buffer storage?

A. Device driver
B. Device controller
C. Interrupt handler
D. Device manager

3. Which of the following is the correct step of data


movement from an application to a device?

A. Application -> Operating system -> Device


controller -> Device Driver -> Device
B. Application -> Device controller -> Operating
system -> Device -> Device controller
C. Application -> Operating system -> Device driver
-> Device controller -> Device
D. Device driver -> Application -> Operating system
-> Device controller -> Device

4. _______ loads the register within the device controller to


give an instruction to the device to perform the specific
operation.

A. Device driver
B. Device manager
C. Device controller
D. DMA controller

100 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

5. What is the meaning concept of plug and play?

A. Operating system automatically configured new


devices
B. Initialize the devices to the operating system
C. Run as interrupt routine
D. Manage hardware devices

6. Which of the following does NOT require a device driver to


be installed in the OS?

A. installing more RAM


B. installing a new monitor
C. installing a printer
D. installing a DVD drive

7. Which of the following is NOT a device manager


responsibility?

A. Maintain the information in the device status table


B. Loads the register within the device controller
C. Deallocates the device
D. Choose the most efficient way to allocate all the
system’s device

8. Which of the following refers to device driver


responsibility?

A. Accept and process interrupts


B. Context switch
C. Provide a standard interface to the device hardware
D. Move data between the peripheral device and its
local buffer

9. Device driver gives an instruction to devices to perform the


operation. Which of the following registers will be used?

A. Data register
B. Command register
C. Status register
D. DMA register

101 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

10. An I/O device manager can do all the following EXCEPT


_______.

A. Update drivers
B. Check for viruses
C. Change peripheral I/O settings
D. Identify installed port

102 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

PROCESS
MANAGEMENT
Chapter 7

103 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
Process management done by process manager and efficiently
managing the CPU’s time.

Figure 7.1 Process Manager Overview

Generally the following are the process manager responsibilities:

• allocate resources to processes


• determining how to allocate processor time among all
the ready processes is known as scheduling
• enable processes to share and exchange information
• protect the resources of each process from other
processes
• manage synchronization among processes. Processes
must often be synchronized, so that processes sharing a
common resource do not step on each other’s toes by
altering critical data or denying each other needed
resources.

104 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

TERMS AND CONCEPTS

Program

Program is inactive entity, such as a file stored on a disk.


Process or task is active entity, which requires a set of resources,
including a processor and special registers to perform its function.
It means that process is a program in execution (jobs - in batch
system, task - in multitasking system).

Process

Process or task is an active entity, which requires a set of


resources, including a processor and special registers to perform
its function. Process is a program in execution (jobs - in batch
system, task - in multitasking system). A process defines the
fundamental unit of computation for the computer. Components
of the process are:

• Object program – code to be executed.


• Data – data is used for executing the program.
• Resources – while executing a program, it may require
some resources.
• Status of the process execution – last component is used
for verifying the status of the process execution.

Processes can be described as:

I/O Bound
• Spends more time doing I/O than computations
• Ready Queue (memory) always empty

CPU Bound
• Spends more time doing computations than I/O
• I/O Queue always empty

System best performance is combination of CPU Bound and I/O


Bound processes. Depending on the operating system (OS), a
process may be made up of multiple threads of execution that
execute instructions concurrently.

105 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Thread

Many modern systems further break the process down into


smaller units called threads. A thread is an individually
executable part of a process. It shares memory and other
resources with all other threads in the same process, but can be
scheduled to run separately from other threads.

Figure 7.2 Process and Multiple Threads

PROCESS CONCEPT

Process State

The current status of the activity of the process, called the


process state. It includes the current position in the program
being executed (the value of the program counter) as well as the
values in the other CPU registers and the associated memory
cells. In order to keep track of the state of all the processes, the
operating system maintains a table known as the process table.
Inside this table, every process is listed along with the resources
in which the process is using and the current state of the process.
Process state can be classified in five types: new, running,
waiting, ready and terminated.

106 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 7.3 Process State Diagram

• New – the process is being created.


• Running – Instructions are being executed (is using the
processor and have all the resources it need for execution).
Only one process can be in the running state at any given
time. (A blocked process was running, but requested a
resource that was unavailable. It will remain blocked until
it is allocated the resource).
• 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

Process Control Block (PCB)

When a process is created, the process manager creates the


process descriptor to keep all the details it requires for
managing the process in Process Control Block (PCB). The
process manager then examines the executable file to determine
what program should be loaded into the address space. Each
process descriptor is allocated when the process is created and de-
allocated when the process terminates. PCB will be created by job
scheduler when a process is put into new state. PCB is also
known as Task Control Block.

107 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 7.4 Process Control Block (PCB)

Process Control Block (PCB) is the data structure that


contains basic info about the job or process:

• Process identification
• Process state
(NEW, READY, RUNNING, WAITING, TERMINATED)
• Process status
(process status word, register contents, main memory
info, resources, process priority)
• Accounting
(CPU time, total amount of time, I/O operations,
number input records read, etc.)

SINGLE TASKING PROCESSING

Single tasking operating system is designed to manage the


computer so that one user can effectively do one thing at a time.
The Palm OS for Palm handheld computers is a good example of a
modern single-user, single-task operating system.

108 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Sequential Processing

In sequential processing, executing one command (let say, ls) will


complete each command before going on to the next. For example,
when you enter commands line by line (pressing Return after
each command), you are telling the system to complete the
command (or program) before executing the next command.

New programs or commands cannot be started until the


preceding program or command has completed. There is no
response to keyboard activity until after the program has
completed.

Batch Processing

In batch processing, sorted jobs or several user programs (with


similar requirements) are grouped into a batch and processed one
after another in a continuous stream. For 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.

Batch jobs are set up so they can be run to completion without


manual intervention, so all input data is preselected through
scripts or command-line parameters. There is no interactive
process, so user cannot interact with program while the program
is running. A program takes a set of data files as input, processes
the data, and produces a set of output data files. The examples of
system that uses batch processing are ATLAS and IBM OS/360.

Job Control Language (JCL) is a scripting language used on IBM


mainframe operating systems to instruct the system on how to
run a batch job or start a subsystem.

MULTITASKING PROCESSING

Multitasking is a method where multiple processes, share


common processing resources such as a CPU. In the case of a
computer with a single CPU, only one task to be running at any
point in time, meaning that the CPU is actively executing
instructions for that task.

109 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Multitasking solves the problem by scheduling which task may be


the one running at any given time, and when another waiting
task gets a turn. The act of reassigning a CPU from one task to
another one is called a context switch. While one program is
waiting for I/O to take place, another can be using the CPU to
execute instructions. The CPU may be switched rapidly between
different programs, executing a few instructions from each, using
a periodic clock-generated interrupt. This process is called time-
slicing. Multitasking system can be classified into two categories:
multiprogramming and time-sharing.

Multiprogramming

The basic idea of multiprogramming is to create systems that


would load several jobs into memory at once and cycle through
them in some order, working on each one for a specified period of
time. For example, consider a machine that can run two jobs at
once. Suppose one job is I/O intensive and the other is CPU
intensive. One way for the monitor to allocate CPU time between
these jobs would be to divide time equally between them.

Figure 7.5 Multiprogramming System

110 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Multiprogramming systems are designed to maximize CPU


usage. In the early days of computing, CPU time was expensive,
and peripherals were very slow. The jobs are usually given
priorities. The operating system switches jobs in and out of
processor time according to priority. In multiprogramming
systems, the running task keeps running until it performs an
operation that requires waiting for an external event (e.g.
reading/writing from/to a disk) or until the computer's scheduler
forcibly swaps the running task out of the CPU. When the first
program reached an instruction waiting for a peripheral, the
context of this program was stored away, and the second program
in memory was given a chance to run. The process continued
until all programs finished running.

Time-sharing

In time-sharing systems, the running task is required to


relinquish the CPU, either voluntarily or by an external event
such as a hardware interrupt. Time sharing systems are designed
to allow several programs to execute apparently simultaneously.
The expression 'time sharing' was usually used to designate
computers shared by interactive users at terminals. The term
time-sharing is no longer commonly used, having been replaced
by simply multitasking, and by the advent of personal computers
and workstations rather than shared interactive systems.

Time-sharing system allows multiple terminals to be connected to


the computer with each in-use terminal being associated with one
or more jobs on the computer. The operating system is
responsible for switching between the jobs which is favored user
interaction. The types of computer system that is implementing
time-sharing system are by VAX/VMS computers and UNIX
workstations. Time-sharing system can be divided into two types
of processing: cooperative time-sharing and preemptive time-
sharing.

Cooperative Multitasking

In co-operative multitasking, operating system hands over


control to a program and waits for the program to hand control
back to the operating system. In this system, operating system is
NOT in control of the computer at all times.

111 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 7.6 Cooperative Multitasking

Cooperative multitasking also known as non-preemptive


multitasking where it is the responsibility of the currently
running task to give up the processor to allow other tasks to run.
This system requires the programmer to place calls at suitable
points in his code to allow his task to be de-scheduled which is not
always easy. If a task does not allow itself to be de-scheduled all
other tasks on the system will not respond to user action.

The advantage is that the programmer knows where the program


will be de-scheduled and can make sure that this will not cause
unwanted interaction with other processes. Cooperative
multitasking usually used in Windows and Macintosh operating
systems.

Preemptive Multitasking

In preemptive multitasking, operating system starts a program


and let’s the program run a while suspends the program and
starts another when it decides. Operating system is IN control of
the computer at all times. This is a type of multitasking where
the scheduler can interrupt and suspend ("swap out") the
currently running task in order to start or continue running
("swap in") another task.

112 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 7.7 Preemptive Multitasking

In preemptive multitasking, operating system (process scheduler)


to preempt or stop temporarily from using the CPU for certain
reason like time-slice expiry. Preemptive multitasking allows the
computer system to more reliably guarantee each process a
regular "slice" of operating time. It also allows the system to
rapidly deal with important external events like incoming
data/processes, which might require the immediate attention of
one or another process.

Under preemptive multitasking the scheduler must ensure that


sufficient state for each process is saved and restored that they
will not interfere. Thus cooperative multitasking can have lower
overhead (affecting cost) than pre-emptive multitasking because
of the greater control it offers over when a task may be
descheduled. Preemptive multitasking usually used in UNIX and
OS/2 operating systems.

SINGLE TASKING VERSUS MULTITASKING

Single tasking was old and simple to implement technique where


the CPU runs a task to completion, and then takes on another
task. Multitasking more complicated technique that allows a
computer to run two or more programs at the same time.

113 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Multitasking is better compared to single tasking for the


following reasons:

• Multitasking improve utilization of CPU and I/O devices


• Multitasking provide illusion of dedicated machine for
each user
• Multitasking support multiple users and multiple
programs to use a single computer
• Multitasking make computer more user friendly

Single Multi- Single


System Multi-Task
User User Task
DOS X X

Windows3.1 X cooperative

Windows95/98/Me X cooperative

WindowsNT/2000 X pre-emptive

WindowsXP X pre-emptive

Unix / Linux X pre-emptive

MAC/OS X X pre-emptive

VMS X pre-emptive

NetWare 6.5 X cooperative

Table 7.1 Types of Operating System and It’s Processing

CONTEXT SWITCHING

When the scheduler switches the CPU from executing one process
to executing another, the context switcher saves the content of all
processor registers for the process that being removed from the
CPU. The context of a process is represented in the PCB. This
process is called context switching.

114 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Context switching can affect performance since modern


computers have a lot of general and status registers to be saved.
Context switch times are highly dependent on hardware support.

Figure 7.8 Context Switching

Context switching occurs when:

• The process exits.


• The process uses up its time slice.
• The process requires another resource that is not currently
available or needs to wait for I/O to complete.

In a context switch, the state of the first process must be saved


somehow, so that, when the scheduler gets back to the execution
of the first process, it can restore this state and continue. The
state of the process includes content of all the registers that the
process may be using, especially the program counter, plus any
other operating system specific data that may be necessary. This
data is usually stored in PCB. Context switching process can be
implemented using hardware or software.

115 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

SCHEDULING

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 so that it requires scheduling policy and a
scheduling algorithm such as FCFS, SJF, SRTF, Round Robin
etc. Scheduling is the process of assigning tasks to a set of
resources performed by scheduler.

Figure 7.9 Job Scheduling

As processes enter the system, they are put into a job queue. Job
queue consists of all processes in the systems. Ready queue
consists of all processes residing in main memory ready and
waiting to execute. Device queue consists of processes waiting for
an I/O device. Each device has its own device queue.

116 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

The process could be removed from the CPU, as a result of an


interrupt, and then put back in the ready queue. The process
continues this cycle until it terminates, at which time it is
removed from all queues and has its PCB and resources de-
allocated.

There are two types of schedulers:

• Short-term scheduler (process/CPU scheduler) – select


from among the processes that are ready to execute, and
allocates the CPU to one of them (select which process
should be executed next and allocates CPU).

• Long-term scheduler (job scheduler) – selects processes


from the pool and loads them into memory for execution
(selection which processes should be brought into the
ready queue).

Short-term Scheduler (CPU Scheduler)

Short-term scheduler or CPU Scheduler assigns the CPU to


execute processes of those jobs placed on ready queue by Job
Scheduler. After a job has been placed on the READY queue by
Job Scheduler, CPU Scheduler then takes over.

CPU Scheduler will:

• Determines which jobs will get CPU, when, and for how
long.
• Decides when processing should be interrupted.
• Determines queues job should be moved to during
execution.
• Recognizes when job has been concluded and should be
terminated.

The primary distinction between short-term and long-terms


schedulers is the frequency of their execution. Short-term
scheduler or CPU scheduler must select a new process for the
CPU quite frequently. A process may be executed for only a few
milliseconds before waiting for an I/O request. Because of the
short duration of time between executions of processes, the short-
term scheduler must be very fast.

117 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Long-term Scheduler (Job Scheduler)

Long-term scheduler is invoked very infrequently (seconds,


minutes between the creation of new processes in the system may
be slow). The long-term scheduler or job scheduler controls the
degrees of multiprogramming (the number of processes in the
memory).

Processes can be described as either:

• I/O bound processes – spend more time doing I/O than


computation
• CPU bound processes – spend more time doing
computations

It is very important for the long-term scheduler select good


process mix of I/O bound and CPU-bound processes. If all
processes are I/O bound, the ready queue will almost always
empty, and short term scheduler will have little to do. If all
processes are CPU bound, the I/O waiting queue will almost
always empty, devices will go unused, and the system will go
unbalanced.

Time-sharing system often has no long-term scheduler, but put


every new process in memory for short-term scheduler. The
stability of the system depends either on a physical limitations
(such as number of available terminals) or on the self-adjusting
nature of human users. The best system performance will have
combination of CPU-bound and I/O bound.

Schedulers Task in Process State

• NEW to READY

This task is done by Job Scheduler using a predefined


policy.

• READY to RUNNING

This task is done by Process Scheduler using some


predefined algorithm.

118 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• RUNNING back to READY

This task is done by Process Scheduler according to


some predefined time limit or other criterion.

• RUNNING to WAITING

This task is done by Process Scheduler and is initiated


by an instruction in the job (I/O request).

• WAITING to READY

This task is done by Process Scheduler and is initiated


by signal from I/O device manager that I/O request has
been satisfied and job can continue.

• RUNNING to TERMINATED

This task is done by Process Scheduler or Job


Scheduler.

119 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES

1. Which of the following is TRUE about a Process Control


Block (PCB)?

A. It consists of several users programs


B. Its amount is fixed for every computer system
C. It can execute the programs
D. No two PCB’s are alike

2. CPU changing from one process to another requires saving


the state of the current process and loading the latest
state of the next process is called _______.

A. Context Switch
B. Packet Switch
C. Process Switch
D. Processor Switch

3. Which of the following statements is NOT TRUE


regarding a process?

A. A process is a sequential program in execution.


B. Operating system processes execute system codes.
C. User processes execute user codes.
D. A process can be executed directly from a secondary
storage

4. Which of the following statements best describe about the


background process?

A. Process needs special hardware requirement like


timer
B. Process has the highest priority among the process
C. Process refers to the several processes in the
memory
D. Process runs when no other process is waiting for
the CPU

120 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

5. _______ system relies on each process to regularly and


voluntarily give up processing time to other processes on
the system.

A. Cooperative Multitasking
B. Preemptive Multitasking
C. Time-sharing
D. Multi-threading

6. As processes enter the system, they are placed into the


following queue EXCEPT _______.

A. Ready queue
B. Dynamic queue
C. Job queue
D. I/O queue

7. A _______ is a smallest sequence of programmed


instruction that can be managed independently by a
scheduler. It can exist within one process, executing
concurrently and share resources such as memory space.

A. segment
B. process
C. thread
D. array

8. A process is in a waiting state when _______.

A. a process is waiting to get the CPU


B. a process is being interrupted
C. a process is waiting for I/O or event to occur
D. a process is finish execution

9. Which of the following is FALSE when switching occur?

A. Using Medium Term Scheduler


B. Context switcher saved current PCB of the process
C. Switching state from Ready to Running state
D. Processes will be selected from devices and load
into memory

121 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

10. In pre-emptive scheduling approach, the CPU switches the


process from _______.

A. New state to Ready state


B. Running state to Ready state
C. Running state to New State
D. Ready state to New State

122 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

MEMORY
MANAGEMENT
Chapter 8

123 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
Memory is a central operation of modern computer. Memory
refers to the physical devices used to store programs (sequences
of instructions) or data (e.g. program state information) on a
temporary or permanent basis. It consists of a large array of
words or bytes each with its own address. Program must be
brought (from disk) into memory and placed within a process for
it to be run. Main memory and registers are the only storage that
CPU can access directly. CPU fetches instruction from memory
based on the value of the program counter.

MEMORY HIERARCHY
A memory hierarchy in computer storage distinguishes each level
in the 'hierarchy' by capacities, costs, and access times.

Figure 8.1 Memory Hiearchy

124 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

If we want to support programs that require more memory than


what’s available in the system, it could be solved by virtual
memory.

Figure 8.2 Virtual Memory

Physical Organization
Physically, computer memory is organized into two levels:

a) Main memory - Main memory is a volatile memory and it


provides fast access at relatively high cost.

b) Secondary memory - Secondary memory is a non-volatile


memory and it is slower and cheaper than main memory.

Main memory available for a program plus its data may be


insufficient. Therefore, programmer must use the mechanism
known as "overlaying“ that is keep in memory only those
instructions and data that are needed at any given time. Program
must be brought secondary memory into main memory and
placed within a process for it to be run.

125 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Logical Organization

The concept of logical address space that is bound to a separate


physical address space is central to proper memory management.
Logical address is the address that is generated by the CPU. It is
also referred to as virtual address. Physical address is the
address as seen by the memory management unit that is the one
that is loaded into the memory address register of the memory.

Memory Management

Memory management is a process which is subdividing memory


to accommodate multiple processes. This process will be done by
memory manager.

Memory needs to be allocated efficiently to pack as many


processes into memory as possible. If only a few processes can be
kept in main memory, then much of the time all processes will be
waiting for I/O and the CPU will be idle.

A process may be broken up into pieces, which do not need to be


located contiguously in main memory. It is not necessary for all
pieces of a process to be loaded in main memory during execution
of the process.

The responsibilities of memory manager are:

• Allocating primary memory to processes and for assisting


the programmer in loading and storing the contents of the
primary memory.

• Keep track of which processes are running in which


memory locations.

• Determine how to allocate and de-allocate available


memory when new processes are created and when old
processes complete execution.

126 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

PHYSICAL MEMORY

One of the memory manager responsibilities is allocating primary


memory to processes. There are two types of physical memory
allocation: contiguous allocation and non-contiguous allocation.

Contiguous Allocation

In contiguous allocation, main memory usually divided into two


partitions:

• Resident operating system, usually held in low memory


with interrupt vector.

• User processes then held in high memory.

Contiguous allocation can be divided into two types of


partitioning: single-partition allocation and multiple-partition
allocation.

In single-partition, there is only one process in a memory at one


time. Protection is done by having one relocation base and one
limit registers for a single process in memory.

In multiple-partition, it allows more than one user processes to


be in memory at one time. In this method, holes of various sizes
are scattered throughout memory. Hole is a block of available
memory space. When a process arrives, it will be allocated to a
hole that is large enough to accommodate it.

Multiple-partition can be divided into two types: fixed partition


allocation and dynamic partition allocation.

Multiple Partition – Fixed Allocation

In fixed partitioning, memory manager partition available


memory into regions with fixed boundaries. Fixed partitioning is
divided by 2 types: equal-size partitions and unequal-size
partitions.

127 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

In equal-size partition, any process whose size is less than or


equal to the partition size can be loaded into an available
partition. If all partitions are full, the operating system can swap
a process out of a partition. A program may not fit in a partition
(if program size greater than partition size). Then, programmer
must design the program with overlays.

In overlays we keep in memory only those instructions and data


that are needed at any given time. When some other instructions
and data are required, they can be loaded into the same space
that was occupied previously by instructions that are no longer
needed.

The use of overlays is limited to the system which have small


amount of memory and lack hardware support for advanced
memory techniques.

But if main memory is used inefficiently, any program, no matter


how small, occupies an entire partition. This may causes a
problem called an internal fragmentation - part of partition
unused or wasted. Unequal-size partitions are better in terms of
internal fragmentation.

Figure 8.3 Fixed Allocation – Equal Size

128 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

In unequal-size partition, processes are assigned in such a way


as to minimize wasted memory within a partition. In a variable
partitioning there are a number of different partition sizes. It is
intended that processes are allocated to the smallest partition it
fits into.

This attempts to minimize the amount of internal fragmentation


as most applications are quite small, but also to allow large
applications to be run.

If the partition which best suited a process is currently occupied


there are a number of strategies to handle such cases. The first is
to multiple queues, a queue per partition size, if a partition is
currently occupied processes queue to use the memory. The
second strategy is to have a single queue and place the process
in the partition of best fit.

Figure 8.4 Fixed Allocation – Unequal Size

129 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 8.5 Equal versus Unequal Size

Multiple Partition – Dynamic Allocation

In dynamic partitioning, partitions are of variable length and


number. Process is allocated exactly as much memory as required
exactly the size it requires. This method cause a problem called
external fragmentation - small holes in non-contiguous that
occur in memory between allocated partitions.

Memory manger use compaction to shift processes so they are


contiguous and all free memory is in one block. Termination of a
process releases its memory block.

Example 8.1

Assume three processes in order of 320K, 224K and 288K to be


allocated in memory. A hole of 64K is left after loading 3
processes and then not enough room for another process.
Eventually each process is blocked.

130 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 8.6 Dynamic Partition

Let assume a process 4 to be allocated with 128K. The memory


manager swaps out process 2 to bring in process 4 and the hole of
96K is created.

Figure 8.7 Dynamic Partition – External Fragmentation

Then each process is still blocked. The memory manager swaps


out process 1 to bring in again process 2 and another hole of 96K
is created. After compaction, it would produce a single hole of
external fragmentation - 256K.

131 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Dynamic Allocation Algorithm

This algorithm is used to decide which free block to allocate to a


process. The goal of dynamic placement algorithm is to reduce the
usage of compaction (because it is time consuming).

There are four possible dynamic allocation algorithms:

• First-Fit

The First-Fit algorithm will allocate the first hole that is


big enough. The memory manager scanning from
beginning and choose the first available block that is large
enough. This is the fastest algorithm but there may have
many process loaded in the front end of memory that must
be scanned.

• Best-Fit

The Best-Fit algorithm will allocate the smallest hole that


is big enough. In this algorithm, the memory manager
must search entire list, unless ordered by size. The main
memory quickly forms holes too small to hold any process
and compaction generally needs to be done more often.
This is a long process and often results in extreme
external fragmentation where very small unusable regions
of memory are left.

• Next-Fit

The Next-Fit algorithm will allocate the first from the last
placement. The memory manager scans memory from the
location of the last allocation and chooses the next
available block that is large enough. This algorithm more
often allocate a block of memory at the end of memory
where the largest block is found. Compaction is required to
obtain a large block at the end of memory.

132 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Worst Fit

The Worst-Fit algorithm will allocate the largest hole in


which it will fit. In this algorithm, the memory manager
also must search entire list, unless ordered by size. It will
produce the largest leftover hole. The First-Fit and the
Best-Fit are better than the Worst-Fit in terms of speed
and storage utilization.

Example 8.2

Figure 8.8 Dynamic Algorithm - before and after allocation


of a process with 16K

None of the above processes solve the external fragmentation


issues but next and first fit are considered better algorithms as
they do not suffer from the linear search overheads that the best
and worst fit algorithms do. In practice next and first generally
do a better job at reducing external fragmentation.

133 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

External Fragmentation vs. Internal Fragmentation

External fragmentation occurs when processes are loaded and


removed from memory, total memory space exists to satisfy a
request, but it is not contiguous. This fragmentation exists in
dynamic partition.

Figure 8.9 External Fragmentation

Internal fragmentation occurs when allocated memory may be


slightly larger than requested memory; this size difference is
memory internal to a partition, but not being used. This
fragmentation exists in fixed allocation.

Figure 8.10 Internal Fragmentation

134 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Both of fragmentation could be solved using compaction method


whereas operating system shuffle memory contents to place all
free memory together in one large block. Beside compaction,
external fragmentation could be solved using paging – allocation
process non-contiguously.

Example 8.3

Given memory partitions of 100K, 500K, 200K, 300K, and 600K


(in order), how would each of the First-Fit, Best-Fit, and Worst-
Fit algorithms place processes of 212K, 417K, 112K, and 426K (in
order)?

Answer 8.3

First-Fit

212K is put in 500K partition


417K is put in 600K partition
112K is put in 288K partition (new partition 288K = 500K - 212K)
426K must wait

Best-Fit

212K is put in 300K partition


417K is put in 500K partition
112K is put in 200K partition
426K is put in 600K partition

Worst-Fit

212K is put in 600K partition


417K is put in 500K partition
112K is put in 388K partition
426K must wait

135 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Non-Contiguous Allocation

In non-contiguous allocation, a process is divided into parts and


different parts of the process should not be allocated
simultaneously. A process gets physical memory wherever this
memory is available. Non-contiguous memory allocation can be
divided into two types: paging and segmentation.

Paging

Paging is a memory management scheme that permits the


physical address space of a process to be non-contiguous. Physical
memory is broken into fixed-sized blocks known as frames. Size of
a frame is power of 2, between 512 bytes and 16 MB. Logical
memory is also broken into blocks of the same size called pages.

Figure 8.11 Concept of Paging (4 pages & 8 frames – size of


4 bytes)

136 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

The frame size is equal to the page size. To run a program of size
n pages, operating system need to find n free frames and load
program. Paging method requires page table to translate logical
to physical addresses. Page table contains base address of each
page in physical memory. Base address is combined with the
page offset to define the physical memory address that is sent to
the memory unit.

Figure 8.12 Paging – Mapping of Three Processes

Address Translation

Address generated by CPU is divided into two parts:

• Page number (p) – used as an index into a page table


which contain base address of each page in physical
memory.
• Page Offset (d) – combined with base address to define the
physical memory address that is sent to the memory unit.

Physical address, number of pages and number of frames can be


calculated by the following formulas:

• Physical Address = (Frame number * Frame size) + Offset


• Number of pages = Program size/Page size
• Number of frames = Memory size/Frame size

137 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 8.13 Address Translation Architectures

Example 8.1

Figure 8.14 Address Translation - Example 8.1

138 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Example 8.2

Figure 8.15 Address Translation – Example 8.2

Example 8.3

Figure 8.16 Address Translation – Example 8.3

139 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Address Calculation

Example 8.4

Given a physical memory size is 64 bytes and the page size is 8


bytes and the page table as below:

Page No Frame No
0 1
1 4
2 3
3 7

Calculate:

a) The physical address for logical address: (2,3) and (1,7).


b) The logical address for physical address: 15.
c) The page number and offset for logical address: 13.

Answer 8.4

a) Logical address (2, 3) means page= 2 and offset = 3. So the


frame number is 3. So the physical address = (Frame
number * Frame size) + Offset = (3 x 8 bytes) +
3 = 27.

Logical address (1, 7) means page= 1 and offset = 7. So the


frame number is 4. So the physical address = (Frame
number * Frame size) + Offset = (4 x 8 bytes) +
7 = 39.

b) If physical address 15 is divided by 8 bytes, the quotient


is 1 and the remainder is 7. It means, frame number
is 1 and offset is 3. So, logical address = (1,7).

c) If logical address 13 is divided by 8 bytes, the quotient is


1 and the remainder is 5. It means page number = 1 and
offset = 5. So (p,d) = (1,5).

140 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Segmentation

Segmentation is a memory-management scheme that supports


user view of memory. In segmentation, a program is assumed as a
collection of segments. A segment is a logical unit such as main
program, procedure, function, method, object, local, variables,
global variables, common block, stack, symbol table and arrays.

Figure 8.17 Concept of Segmentation

In segmentation, logical address consists of two parts: segment-


number and offset.

It requires a Segment Table to map the logical address space to


physical memory, consists of:

• Base - starting physical address where the segment


resides in memory.
• Limit - specifies the length of the segment

141 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Segmentation causes external fragmentation. Physical Address


is calculated by the total number of segment base and offset.
Offset must be less than limit value in the segment table.
Segmentation allows sharing of common codes and protection is
done using the protection bit.

Example 8.5

Given the following table:

Segment Base Length


0 219 600
1 2300 14
2 90 100
3 1327 580
4 1952 96

What are the physical addresses for the following logical


addresses?

a) (0,430)
b) (1,10)
c) (2,500)
d) (3,400)
e) (4,112)

Answer 8.5

a) 219 + 430 = 649


b) 2300 + 10 = 2310
c) Illegal reference, trap to operating system
d) 1327 + 400 = 1727
e) Illegal reference, trap to operating system

142 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

VIRTUAL MEMORY

The various memory-management strategies discussed have one


common goal: to keep many processes in memory simultaneously
to allow multiprogramming. However, they tend to require that
an entire process be in memory before it can execute. Virtual
memory is a technique that allows the execution of processes
that are not completely in memory.

The advantages of virtual memory are:

• Program size can be larger than physical memory size.


• Programmers need not to worry about the amount of
physical memory available.
• More programs can be run at the same time.

Virtual memory can be implemented via:

• Demand paging
• Demand segmentation

Page Fault

Pages of processes are resided on secondary storage, when it is


needed for execution, a page will be swapped into memory. Page
is needed must have reference to it. Then:

• if reference is invalid reference, execution is abort.


• if reference is not-in-memory, pages must be brought
into memory.

So, it requires Valid-Invalid Bit to distinguish between pages


that are in memory and pages that are on the disk.

During address translation, if valid–invalid bit in page table


entry is 1 or V, it means page is in the memory, but if Valid-
Invalid Bit is 0 or I, it means page fault.

Page fault is a trap to operating system indicating the page is not


in memory.

143 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 8.18 Page Fault

Handling Page Fault

To handle page faults, the memory manager takes the following


steps:

1) Operating system looks at another table to decide.


2) Invalid reference, just not in memory, execution abort
(trap).
3) Check page is on backing store.
4) Get empty frame, then swap page into frame.
5) Reset tables.
6) Set validation bit = V.
7) Restart the instruction that caused the page fault.

144 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 8.18 Steps in Handling Page Fault

Thrashing

Thrashing is a situation when a process is busy swapping pages


in and out (very high paging activity). Swapping out a piece of a
process just before that piece is needed. Swapping causes more
time doing paging than executing.

Principle of Locality

A locality is a set of pages that are actively used together. As a


process executes, it moves from locality to locality. A program is
generally composed of several different localities which may
overlap. Only a few pages of a process will be needed over a short
period of time. it is possible to make intelligent guesses about
which pages will be needed in the future.

145 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES

1. In memory management, physical memory is broken


into fixed sized blocks in paging technique called _______.

A. Frames
B. Holes
C. Blocks
D. Segments

2. In _______ a page will be loaded into the memory only if it


is required to be used for execution.

A. Virtual memory
B. Paging
C. Segmentation
D. Dynamic partitioning

3. _______ memory allocation scheme always give the best


space utilization.

A. First fit
B. Best fit
C. Worst fit
D. Next fit

4. In paging, the physical memory is divided into the


same size _______ while the logical address space is
divided into the same size _______.

A. paging, segmentation
B. pages, frames
C. segments, pages
D. frames, pages

5. Demand paging is similar to paging with _______.

A. swapping
B. debugger
C. thrashing
D. overlays

146 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

6. The type of memory that allows for very active


multiprogramming and relieves the user of memory size
constraints is referred to _______.

A. real memory
B. virtual memory
C. main memory
D. all of the above

7. In _______, a page will be loaded into the memory only if it


is required to be used for execution.

A. virtual memory
B. paging
C. segmentation
D. dynamic execution

8. Which of these memory allocation schemes always gives


the best space utilization.

A. First Fit
B. Best Fit
C. Worst Fit
D. Next Fit

9. Virtual memory can be implemented using _______.

A. time sharing system


B. multithreading system
C. demand paging
D. thrashing

10. Which of the following memory allocation method will


NOT result in external fragmentation?

A. Best Fit
B. First Fit
C. Paging
D. Segmentation

147 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INPUT OUTPUT
MANAGEMENT
Chapter 9

148 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
Humans interact with machines by providing information
through I/O devices such as screen displays, printers, keyboards,
mouse, etc. Management of all these devices can affect the
throughput of a system. For this reason, input output
management also becomes one of the primary responsibilities of
an operating system. I/O manager manages the system’s device
drivers or works with the Virtual Memory manager to provide
memory mapped file I/O and manages the file system buffers.

INPUT OUTPUT SYSTEM ORGANIZATION

Generally, two mains jobs of a computer are input output


operations and computer processing. The role of operating system
in computer is to manage and control I/O operations and I/O
devices.

The challenge is the wide variety of I/O devices based on the


certain differences such as delivering at different amounts of
data, delivering at different speeds or delivering in different
formats.

Figure 9.1 Varieties of I/O Devices

149 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

To manage input output devices, two main issues must be


considered that is speed and coordination.

For example, in the issue of speed, CPU operates at speeds much


faster than the I/O devices and in the issue of coordination,
several devices perform I/O simultaneously. In order to manage
speed and coordination issues, it needs I/O modules.

I/O modules responsible for the control of one or more external


devices and for the exchange of data between those devices and
memory or CPU registers (small amount of storage available as
part of a CPU). I/O modules act as an interface to devices and
memory.

Figure 9.2 I/O Module

The following are I/O processing steps:

• CPU checks I/O module for device status (polling) either


ready, busy error.
• I/O module returns status
• If busy, need to wait I/O device
• If ready, CPU requests data transfer
• I/O module gets data from device
• I/O module transfers data to CPU

There are three types of I/O modules:

• Programmed I/O (with polling)


• Interrupt Driven I/O
• Direct Memory Access

150 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Programmed I/O (With Polling)

In programmed I/O (with polling), data are exchanged between


the CPU and the I/O module and CPU has direct control of the
I/O operation. Polling means the CPU is busy-waiting. When the
CPU issues a command to the I/O module it must wait until the
I/O operation is complete.

Figure 9.2 Programmed I/O (with polling)

Interrupt Drive I/O

In interrupt driven I/O, the CPU issues a command and then


continues to execute other instructions and the I/O module issues
an interrupt when it completes its task. Interrupt means I/O
module (device controller) notify the CPU when the device
becomes ready for service.

151 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 9.3 Interrupt Driven I/O

Direct Memory Access (DMA)


When large blocks of data need to be transferred between a device
and main memory, the CPU sends a signal to a special chip called
the DMA controller.

Figure 9.4 Direct Memory Access (DMA)

152 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

DMA disconnects the CPU to feed data directly from I/O module
to memory (or from memory to I/O module). When finished,
control is handed back again to the CPU. DMA transfers are
common for disk drives, sound cards and graphics cards.

INPUT OUTPUT COMMUNICATION


TECHNIQUES

When the CPU encounters an instruction relating to I/O it


executes that instruction by issuing a command to the
appropriate I/O module.

Three techniques are possible for I/O operations (based on I/O


Module Type):

• Programmed I/O (with Polling)


• Interrupt Driven I/O
• Direct Memory Access (DMA)

Programmed I/O (with Polling)

In this technique, the I/O module performs the requested action


and then sets the appropriate bits in the I/O status register but
takes no further action to alert the processor. As there are no
interrupts, the processor must determine when the instruction is
complete.

The following are the basic Programmed I/O Basic Operations:

• CPU requests I/O operation


• I/O module performs operation
• I/O module sets status bits
• CPU checks status bits periodically (polling)
• I/O module does not inform CPU directly
• I/O module does not interrupt CPU
• CPU may wait or come back later

153 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

With this approach is difficult to achieve high CPU utilization,


since the CPU must constantly check the controller status to
determine when the operation has completed. An example of this
technique applied when data read in a word at a time. Processor
remains in status-checking loop while reading.

Figure 9.5 Programmed I/O (Direct I/O With Polling)


Technique

Interrupt Driven I/O

In this technique, the processor issues an I/O command to a


module and then goes on to do some other useful work. The I/O
module will then interrupt the processor to request service when
it is ready to exchange data with the processor.

154 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

This technique can overcomes CPU waiting but everything passes


through CPU. There is no repeated CPU checking of device and
I/O module interrupts when ready.

The following are the basic Interrupt Driven I/O Basic


Operations:

• CPU issues read command


• I/O module gets data from peripheral while CPU does
other work
• I/O module interrupts CPU
• CPU requests data
• I/O module transfers data

Figure 9.6 Interrupt Driven I/O Communication Technique

155 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Direct memory Access (DMA)

In this technique DMA bypasses CPU to transfer data directly


between I/O device and memory . DMA controller (additional
module) takes over from CPU for I/O operation. DMA usually
used to avoid programmed I/O for large data movement. When
needing to read/write, CPU issues a command to DMA module
and I/O operation delegated to DMA module. CPU only involved
when beginning and ending transfer. DMA much more efficient
compared to the both of the previous techniques.

The following are the basic DMA Operations:

• CPU tells DMA controller for the operation of read/write,


device address, starting address of memory block for data
and amount of data to be transferred
• CPU carries on with other work
• DMA controller deals with transfer
• DMA controller sends interrupt when finished

Figure 9.7 DMA Communication Tehcnique

156 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INPUT OUTPUT BUFFERING

A buffer is a memory area that stores data being transferred


between two devices or between a device and an application.
Buffering is the technique by which the device manager can keep
slower I/O devices busy during times when a process is not
requiring I/O operations.

Input buffering is the technique of having the input device read


information into the primary memory before the process requests
it. Output buffering is the technique of saving information in
memory and then writing it to the device while the process
continues execution

Why using buffer?

• To cope with device speed mismatch.

As an example, buffer is used when a file is being received via


modem for storage on the HDD. The modem is about 1000x
slower than HDD. So a buffer is created in main memory to
accumulate the bytes received from modem. When an entire
buffer of data has arrived, the buffer can be written to disk in
a single operation.

• To provide adaptations for devices that have


different data-transfer sizes.

As an example, buffer is used commonly in computer


networking. At the sending side, a large message is
fragmented into small network packets. The packets are sent
over the network and the receiving side places them in a
reassembly buffer to form an image of the source data.

• To support copy semantics for application I/O

Suppose an application has a buffer of data that it wishes to


write to disk. With copy semantics, the version of data written
to disk is guaranteed to be the version at the time of the
application system call.

157 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Types of Buffer

Basically buffer has many types:

• Single Buffer
• Double Buffer
• Circular Buffer

Single Buffer

Figure 9.8 Single Buffer

Double Buffer

Figure 9.9 Double Buffer

Circular Buffer

In circular buffer more than two buffers are used. Each individual
buffer is one unit in a circular buffer. Circular buffer normally
used when I/O operation must keep up with process.

158 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 9.10 Circular Buffer

Types of I/O Devices

There are two types of I/O devices:

Block-Oriented devices

Block-oriented devices store information in blocks that are


usually of fixed size. Data transfers are made one block at a time.
Example of block-orientaed devices are disk and tape.

Stream-Oriented devices

Stream-oriented devices transfer data in and out as a stream of


bytes, with no block structure. Example of stream-oriented
devices are terminals, printers, communications port and mouse.

Stream –oriented devices can be divided by 2 types:

• Line-at-a-time
• Byte-at-a-time

159 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. During I/O or event completion, a process will be change
_______.

A. from NEW to READY


B. from READY to RUNNING
C. from RUNNING to WAITING
D. from WAITING to READY

2. What is the main advantage of Direct Memory Access


(DMA)?

A. Increase system performance by increasing


concurrency
B. Allow CPU to run faster
C. Reduces the traffic on the data bus
D. Removes the requirement that transfers be
properly aligned

3. In _______ the system temporarily stores data in the


memory while transferring them between two devices.

A. spooling
B. caching
C. device reservation
D. buffering

4. In _______ technique CPU only involved when beginning


and ending transfer.

A. Programmed I/O
B. Interrupt Driven I/O
C. Direct Access Memory
D. Not all of the above

160 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

5. The following are the examples of stream-oriented


devices EXCEPT _______.

A. terminal
B. disk
C. printer
D. mouse

6. A method that allows an input output (I/O) device to send


or receive data directly to or from main memory without
intervention from CPU is known as _______.

A. Direct I/O with Polling


B. Interrupt Driven I/O
C. Direct Memory Access
D. Programmed I/O

7. Which of the statement is TRUE about interrupt-driven


I/O?

A. It control program that handles the interruption


sequence of events
B. An operating system is interrupt-driven
C. It provide a way in which peripheral device can
initiate communication with CPU
D. It required the process is busy waiting for the
operation to be completed before proceed to other
process

8. What is the main advantage of Direct Memory Access


(DMA)?

A. Increase system performance by increasing


concurrency
B. Allow CPU to run faster
C. Reduces the traffic on the data bus
D. Removes the requirement that transfer be properly
aligned

161 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

9. “ I/O devices operate with user through character oriented


devices. CPU has to wait I/O operation to finish before
proceeding. CPU periodically check the status of I/O
module. It can waste large amounts of CPU time and
therefore inefficient in terms of CPU usage “.

The above statements are ALL about _______>

A. Programmed I/O
B. Interrupt Service Routine
C. Interrupt-Driven I/O
D. Direct Memory Access

10. Which of the following techniques is NOT possible for I/O


operations?

A. Programmed I/O with Polling


B. Interrupt-Driven I/O
C. Buffer Interrupt I/O
D. Direct Memory Access

162 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

OPERATING SYSTEM
PROTECTION &
SECURITY
Chapter 10

163 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

INTRODUCTION
Multiprogramming involves the sharing of many resources,
including processor, memory, I/O devices, programs, and data.
Protection of such resources runs along the following spectrum:

• Share all or nothing implies that an object is either totally


private or totally public.

• Share via access limitation implies that different entities


enjoy different levels of access to an object, at the gift of
the owner. The OS acts as a guard between entities and
objects to enforce correct access.

• Limit use of an object implies that not only is access to the


object controlled, the use to which it may be put also
varies across entities.

Security must consider external environment of the system, and


protect the system resources because intruders (crackers) may
attempt to breach security. A potential security violation is called
threat and an attempt to breach security is called an attack.
Attack can be accidental or malicious. It is easier to protect
against accidental than malicious misuse.

SECURITY AND PROTECTION

What is Protection and Security?


Protection is the mechanisms that can be used to control access
to various resources.

Security is the measurement of confidence that the integrity of a


system and its data will be preserved. It includes a well-specified
threat description and policies for how to configure internal and
external protection mechanisms to deal with that threat.

Computer protection and security mechanisms provided by an


operating system must address the following requirements:

164 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Confidentiality
Confidentiality or privacy is the requirement that information
maintained by a computer system be accessible only by
authorized parties.

Integrity
Integrity is the requirement that a computer system’s resources
can be modified only by authorized parties.

Availability
Availability is the requirement that a computer system be
accessible at required times by authorized parties.

Authenticity
Authenticity is the requirement that a computer system can
verify the identity of a user.

Goal of Protection and Security


Operating system consists of a collection of objects, hardware or
software. Each object has a unique name and can be accessed
through a well-defined set of operations.

Protection mechanism ensures that each object is accessed


correctly and only by those processes that are allowed to do so. It
also can prevent mischievous, intentionally violation of an access
restriction by a user.

Security mechanism ensures the confidence that the


confidentiality, the integrity and the availability of a system and
its data will be preserved.

165 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

USER AUTHENTICATION

What is Authentication?

Authentication is the process of determining whether someone


or something is, in fact, who or what it is declared to be. File
permissions are based on user identity, which is based on
authentication. In private and public computer networks
(including the Internet), authentication is commonly done
through the use of logon passwords.

Nowadays, there are several methods are used for authentication


process:

What User Knows (software)

This method usually uses user identification and password.

What User Have (hardware)

This method usually uses physical material known as tokens such


smartcard, ATM card and credit card.

What User Are (user characteristics)

This method usually uses personal behavior known as biometrics


such as fingerprint, retina, iris, hand, face and voice.

What User Knows

A password is a secret word or string of characters that is used


for authentication, to prove identity or gain access to a resource.
Password is a very common method used for authentication
computer user and originally stored in a plaintext. For example,
an access code is a type of password. The password should be kept
secret from those not allowed access.

166 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Knowledge of the password is assumed to guarantee that the user


is authentic. Each user registers initially (or is registered by
someone else), using an assigned or self-declared password. On
each subsequent use, the user must know and use the previously
declared password.

Even password can be used for authentication but password has


several vulnerabilities as the following:

• Password can be guessed


• Password can be brute-forced (trying all possible
combinations)
• Password can be exposed as a result of visual (shoulder
surfing), password written down and electronic monitoring
(sniffing)
• User selected password is easier to guessed (if use a
simple password)
• System generated password is difficult to remember (can
be forgotten)

To overcome the password vulnerabilities, we can use the


following methods:

Password Encryption
The encryption method can avoid password guessing, for
example, in UNIX operating system, encrypted data will be kept
in /etc/shadow file.

Single Sign-on
Single sign-on (SSO) is a property of access control of multiple
related, but independent software systems. With this method, a
user logs in once and gains access to all systems without being
prompted to log in again at each of them.

Keep Password in Token


In this method, users need not to remember their passwords and
therefore can select more secure passwords, or have more secure
passwords assigned.

167 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

One-time Password (OTP)

One-time password is a password that is valid for only one


login session or transaction. It is a unique 6-character code that
can only be used once and is sent only to your registered mobile
number in BDO Online Banking.

What User Have

Token is a security device given to authorized users who keep


them in their possession. To log in to the network, the security
"card" or "token" may be read directly like a credit card, or it may
display a changing number that is typed in as a password.
Tokens may also plug directly into the computer via a USB port.

Security tokens are used to prove one's identity electronically (as


in the case of a customer trying to access their bank account). The
token is used in addition to or in place of a password to prove that
the customer is who they claim to one login session or
transaction.

There are several types of tokens:

• Disconnected token
• Connected token
• Contactless token

Disconnected Token

This type of token is neither a physical nor logical connection to


the client computer.

Typically use a built-in screen to display the generated


authentication data, which the user enters manually themselves
via a keyboard or keypad. Disconnected tokens are the most
common type of security token used (usually in combination with
a password) in two-factor authentication for online identification.

168 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 10.1 Disconnected Token

Connected Token

This token must be physically connected to the client computer.


It is automatically transmit the authentication info to the client
computer once a physical connection is made. Appropriate input
device must be installed to use this token.

Figure 10.2 Connected Token

Common types of connected token are smart cards and USB


tokens, which require a smart card reader and a USB port
respectively.

169 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Contactless Token

Contactless token form a logical connection to the client computer


but do not require a physical connection. This type of token more
convenient than both connected and disconnected tokens. This
token is a popular choice for keyless entry systems and electronic
payment solutions which uses RFID to transmit authentication
info from a keychain token.

Figure 10.3 Contactless Token

What User Are

This method usually uses biometric method. Biometrics refers to


technologies that measure and analyze human body
characteristics, such as DNA, fingerprints, eye retinas and irises,
voice patterns, facial patterns and hand measurements, for
authentication purposes.

As mentioned in the above, biometric characteristics can be


divided in 2 classes:

• Physiological are related to the shape of the body.


Examples include, but are not limited to fingerprint, face
recognition, DNA, Palm print, hand geometry, iris
recognition.

170 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

• Behavioral are related to the behavior of a person.


Examples include, but are not limited to typing rhythm,
gait, and voice.

BASIC RESOURCE PROTECTION

Operating system consists of a collection of objects (hardware or


software) which has a unique name and can be accessed through
a well-defined set of operations. Protection problem is to ensure
that each object is accessed correctly and those processes that are
allowed to do so.

Access Control

Access Control is an internal (to an operating system)


protection mechanism. One form of access control is seen in CPU
instructions that may only be executed in supervisor mode, which
usually amounts to within the kernel. The division of virtual
memory into kernel and user parts is also a form of access
control. Access control plays an important role at the
administrative level too. The well-aged Access Matrix model is
basis for several access control mechanisms.

Access Matrix model views protection as a matrix (access


matrix). Rows represent domains and columns represent objects.
Access (i, j) is set of operations that process executing in Domaini
can invoke on Objectj. Access Matrix model consists of three
elements: objetcs, subjects and rights.

Objects
Objects are the resources in the system that need access control
(that is, must be accessed in a protected fashion). For example,
hardware devices, data files, etc.

Subjects
Subjects are active entities in the system that access objects. For
example, user processes.

171 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Rights

Rights are the operations (such as enable, disable, read, write,


execute, etc. on objects are represented by access rights.

Access-right = <object-name, rights-set> where rights-set is a


subset of all valid operations that can be performed on the object.

Figure 10.4 Access Matrix Model

Privileged User

Access control is based on the privilege. Privilege is the right to


execute a system call or to use an option within that system call
(opening a file with write access).

Privileged user is a user who has been allocated powers within


the computer system, which are significantly greater than those
available to the majority of users. For example, the system
administrator(s) and Network administrator(s) who are
responsible for keeping the system available and may need
powers to create new user profiles as well as add to or amend the
powers and access rights of existing users

172 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Superuser
In conventional UNIX systems, the root user, also referred to as
superuser, is all-powerful. Programs that run as root, or setuid
programs, are all-powerful. The root user has the ability to read
and write to any file, run all programs, and send kill signals to
any process. Effectively, anyone who can become superuser can
modify a site's firewall, read confidential records, and shut down
the entire network.

Roles Based Access Control (RBAC)


Role-based access control (RBAC) provides a more secure
alternative to the all-or-nothing superuser model. RBAC uses the
security principle of least privilege. Least privilege means that a
user has precisely the amount of privilege that is necessary to
perform a job. Ordinary users have enough privilege to use their
applications, check the status of their jobs, print files, creates new
files, and so on.

CPU and Memory Protection

In a multiprogramming environment, protection of main memory


and CPU is essential (important). There are three types of
protection:

• Buffer Overflow
• Data Execution
• Kernel Patch

Buffer Overflow Protection


A buffer overflow, or buffer overrun, is an anomaly where a
program, while writing data to a buffer, overruns the buffer's
boundary and overwrites adjacent memory. This is a special case
of violation of memory safety. Buffer overflows can be triggered
by inputs that are designed to execute code, or alter the way the
program operates. This may result in erratic program behavior,
including memory access errors, incorrect results, or a breach of
system security.

173 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Buffer overflows usually resulting from a conceptual flaw in the C


programming language. Many programs susceptible, due to lack
of good coding standards and most applications are written in C,
or C++. BOs enable overwriting entire regions of memory with
arbitrary data. Buffer overflow protection is used to detect the
most common buffer overflows by checking that the stack has not
been altered when a function returns. If it has been altered, the
program exits with a segmentation fault.

Buffer overflow can be protected using the following methods:

Use of Safe Libraries

Avoid using standard library functions which are not bounds


checked, such as gets, scanf and strcpy.

Use Canaries

Canaries or canary words are known values that are placed


between a buffer and control data on the stack to monitor buffer
overflows. When the buffer overflows, the first data to be
corrupted will be the canary, and a failed verification of the
canary data is therefore an alert of an overflow, which can then
be handled, for example, by invalidating the corrupted data.

Kernel Patch Protection

Kernel is the lowest-level, most central part of a computer


operating system. It is code to load when the machine starts up.
Kernel enables the software of the machine to talk to the
hardware and is responsible for basic OS housekeeping tasks
such as memory management, launching programs and
processes, and managing the data on the disk.

Kernel Patch Protection (KPP), informally known as PatchGuard,


is a feature of x64 editions of Microsoft Windows that prevents
patching the kernel. It was first introduced in 2005 with the x64
editions of Windows XP and Windows Server 2003 Service Pack
1.

174 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

"Patching the kernel" refers to unsupported modification of the


central component or kernel of the Windows operating system.
Such modification has never been supported by Microsoft because
it can greatly reduce system security and reliability.

However, though Microsoft does not recommend it, it is


technically possible to patch the kernel on x86 editions of
Windows. But with the x64 editions of Windows, Microsoft chose
to implement technical barriers to kernel patching.

Kernel Patching is the practice of using unsupported mechanisms


to modify or replace kernel code. Kernel patch can result in
unpredictable behavior, system instability and performance
problems—like the Blue Screen of Death–which can lead to lost
user productivity and data. A mechanism used by malware
developers to attack Windows systems.

Kernel Patch Protection monitors if key resources used by the


kernel or kernel code itself has been modified. If the operating
system detects an unauthorized patch of certain data structures
or code, it will initiate a shutdown of the system.

Kernel patch protection does not prevent all viruses, or other


malware from attacking the operating system but it helps prevent
one way to attack the system: patching kernel structures and
code to manipulate kernel functionality.

Protecting the integrity of the kernel is a fundamental step in


protecting the entire system from malicious attacks and from
reliability problems that result from patching.

Data Execution Protection

Data Execution Prevention (DEP) is a security feature


included in modern operation systems.

It is available in Linux, Mac OS X and the newer Microsoft


Windows operating systems and is intended to prevent an
application or service from executing code from a non-executable
memory region.

175 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

Figure 10.5 DEP in Windows

DEP helps prevent certain exploits that store code via a buffer
overflow, for example. DEP runs in two modes: hardware-
enforced DEP for CPUs that can mark memory pages as non-
executable and software-enforced DEP with a limited prevention
for CPUs that do not have hardware support.

176 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

EXERCISES
1. One of the goals of protection in the operating system is to
ensure each program component active in a system uses
system _________ only in ways consistent with stated
policies.

A. resources
B. standards
C. users
D. processor

2. _________ is the process of determining whether someone


or something is, in fact, who or what it is declared to be.

A. Authorization
B. Authentication
C. Confidentiality
D. Privacy

3. Which one of the following is NOT user authentication


software?

A. Password
B. PIN
C. User ID
D. Token

4. _______ is a set of hardware and software technologies


that perform additional checks on memory space to
help prevent malicious code from running on a system.

A. Canaries
B. Data Execution Protection
C. Kernel patch Protection
D. Buffer Overflow Protection

5. _______ is protection mechanism for LINUX file systems.

A. Access Control List


B. Security Scheduler
C. User Domains
D. Biometrics

177 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

6. Which of the following is FALSE regarding token?

A. Token may plug and play directly into the computer


B. Each process control block contains its default
access token
C. It is used behavioral-based authentication method
such as typing rhythm, gait and voice
D. It is an alternative hardware-based form of
authentication

7. Access matrix model required as following EXCEPT


_______.

A. objects
B. subjects
C. rights
D. user’s role

8. The diagram below shows the set up for parenting control.


What is the name of it in term of security?

A. Authorization
B. Authentication
C. Security
D. Protection

178 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

9. “ When the physical device is inserted into computer, it


will ask for a password “.

The above statement correctly refers to _______.

A. Login ID
B. Token
C. Biometrics
D. Username

10. A logical connection to the client computer but do not


require a physical connection is called _______.

A. Disconnected token
B. Connected token
C. Contactless token
D. Logical token

179 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

REFERENCES

180 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

1. William Stallings, Operating Systems: Internals and


Design Principles, 9th Edition, Pearson Education, 2018.

2. Rajiv Chopra, Operating Systems - A Practical


Approach, 4th Edition, S Chand Publishing, 2016.

3. B. Mohamed Ibrahim, Linux: A Practical Approach,


Laxmi Publications, 2016.

4. Abraham Silberschatz, Greg Gagne, Peter B. Galvin,


Operating System Concepts, 10th Edition, Wiley, 2018.

5. Nutt, G., Operating Systems, Third Edition, Addison-


Wesley, 2014.

6. Silberschatz, A., Galvin, P. A. & Gagne, G., Operating


Systems Concepts, Eight Edition, John Wiley, 2010.

7. Tanenbaum, Andrew S., Modern Operating Systems, 3rd


Edition, Prentice-Hall, 2009.

8. Stuart, B. L., Principles of Operating Systems, Thomson


Course Technology, 2009.

9. McHoes, A. M. & Flynn, I. M., Understanding Operating


Systems, 5th Edition, Cencage Learning, 2007.

181 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)


lOMoARcPSD|17821011

PRACTICAL APPROACH OF
OPERATING SYSTEMS
Second Edition
Operating systems are an essential part of any computer
system. A course on operating systems is an essential
part of any computer-science education. This book is
presented as a text for an introductory course in operating
systems at the junior or senior undergraduate level or at
the first-year graduate level. It provides a clear description
of the fundamental concepts that underlie operating
systems.

Learning operating system is very important to computer


science students. Without good understanding about
operating system, computer science student could face
the problem in their study especially about computer
system and computer programming.

This book consists of nine topics and each topic is related


to each other. Through this book the reader can learn
about the concept of operating system such as the
functions, the components and the booting concept. The
reader also can study about how operating system
manages the file, the computer processing, the memory
and the input and output. The operating system
protection and security also covered in this book through
the last chapter.

I am very appreciates to hearing from readers about any


suggestions and comments that identified in this book for
improvements. Thank you and happy reading.

AL-FATEH PUBLICATIONS

182 Practical Approach of Operating System

Downloaded by popsoda (amirahmadafiq@gmail.com)

You might also like