0% found this document useful (0 votes)
118 views

Module 3 Operating Systems

Uploaded by

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

Module 3 Operating Systems

Uploaded by

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

Computer Science Unit 2 – Module 3

OPERATING SYSTEMS
OPERATING SYSTEMS AND COMPUTER NETWORKS

The Operating System 4


Operating System Management Tasks 4
Functions of Operating System 5

History of Operating Systems 5


Operating Systems - Late 1950s 5
Operating Systems - In 1960s 6
Supported OS Features by 1970s 6
Accomplishments after 1970 6

Types of Operating Systems 7


Simple Batch Systems 8
Advantages of Simple Batch Systems 8
Multi-User Operating Systems 8

Functions of the Operating System 9


Bootstrap process 9

Process Management 10
Process states 10
Process Control Block 10

What is a Deadlock? 11
How to avoid deadlocks 11
Mutual Exclusion 11
Hold and Wait 12
No Preemption 12
Circular Wait 12
Handling deadlock 12
Preemption 12
Rollback 12
Kill one or more processes 12

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 1
Process Scheduling & Scheduling Algorithms 13
Pre-emptive 13
Non-pre-emptive 13
Throughput 13
Turnaround Time 13
Waiting Time 14
Load Average 14
Response Time 14
Scheduling Algorithms 14
Aim of scheduling 14
Shortest Job First(SJF) Scheduling 15
Problem with Non-pre-emptive SJF 15
Pre-emptive Shortest Job First 15
Round Robin Scheduling 15
First Come First Serve Scheduling 16
Problems with FCFS Scheduling 16
Priority Scheduling 16

Comparison of Scheduling Algorithms 17


First Come First Serve (FCFS) 17
Shortest Job First (SJF) 17
Round Robin (RR) 18
Priority based Scheduling 18
Usage of Scheduling Algorithms in Different Situations 18
Situation 1: 18
Situation 2: 19
Situation 3: 19
What is an Interrupt? 20
Types of Interrupts: 20
Interrupt Handling: 21

Memory Management & Device Management 22


Virtual Memory 22
Paging 22
Thrashing 22

Device Management 23
Device drivers 23
Devices, Interrupt handling and the PCB 23
Input/output control & peripheral control 23

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 2
Polling 24
Buffer 24
Spooling 24

File Management 25
File 25
Directories/Folders 25
Security of files 25
User IDs 25
Passwords 25
Lockwords, 26
Access control list, 26
File Encryption 26
File compression 26
Activity logs 26

User Interface 27

Links and References 28


Acknowledgement 28

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 3
The Operating System
A computer system has many resources (hardware and software), which may be required to
complete a task. The commonly required resources are input/output devices, memory, file
storage space, CPU etc. The operating system acts as a manager of the above resources and
allocates them to specific programs and users, whenever necessary to perform a particular task.
Therefore operating system is the​ resource manager​ i.e. it can manage the resource of a
computer system internally. The resources are processor, memory, files, and I/O devices. In
simple terms, an operating system is the ​interface ​between the user and the machine.

Operating System Management Tasks


● Processor management which involves putting the tasks into order and pairing them into
manageable size before they go to the CPU.
● Memory management which coordinates data to and from RAM (random-access
memory) and determines the necessity for virtual memory.
● Device management which provides interface between connected devices.
● Storage management which directs permanent data storage.
● Application which allows standard communication between software and your computer.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 4
● User interface which allows you to communicate with your computer.

Functions of Operating System


1. It boots the computer
2. It performs basic computer tasks e.g. managing the various peripheral devices e.g.
mouse, keyboard
3. It provides a user interface, e.g. command line, graphical user interface (GUI)
4. It handles system resources such as computer's memory and sharing of the central
processing unit(CPU) time by various applications or peripheral devices.
5. It provides file management which refers to the way that the operating system
manipulates, stores, retrieves and saves data.
6. Error Handling is done by the operating system. It takes preventive measures whenever
required to avoid errors.

History of Operating Systems


The evolution of operating systems is directly dependent on the development of computer
systems and how users use them.

Operating Systems - Late 1950s


By the late 1950s Operating systems were well improved and started supporting following
usages:

● It was able to perform ​Single stream batch processing​.

● It could use Common, standardized, input/output routines for device access.

● Program transition capabilities to reduce the overhead of starting a new job was

added.

● Error recovery​ to clean up after a job terminated abnormally was added.

● Job control languages that allowed users to specify the job definition and resource

requirements were made possible.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 5
Operating Systems - In 1960s
● 1961: The dawn of minicomputers

● 1960s: Disks became mainstream

● 1966: Minicomputers got cheaper, more powerful, and really useful.

● 1967-1968: ​Mouse​ was invented.

Supported OS Features by 1970s


● Multi User​ and ​Multi tasking​ was introduced.

● Dynamic address​ translation hardware and ​Virtual machines​ came into picture.

● Modular architectures​ came into existence.

● Personal, interactive systems came into existence.

Accomplishments after 1970


● 1971: Intel announces the microprocessor

● 1972: IBM comes out with VM: the Virtual Machine Operating System

● 1973: Ethernet

● 1974 The Personal Computer Age begins

● 1974: Gates and Allen wrote BASIC for the Altair

● 1976: Apple II

● August 12, 1981: IBM introduces the IBM PC

● 1983 Microsoft begins work on MS-Windows

● 1984 Apple Macintosh comes out

● 1990 Microsoft Windows 3.0 comes out

● 1991 GNU/Linux

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 6
● 1992 The first Windows virus comes out

● 1993 Windows NT

● 2007: iOS

● 2008: Android OS

And as the research and development work continues, we are seeing new operating systems
being developed and existing ones getting improved and modified to enhance the overall user
experience, making operating systems fast and efficient like never before.

Also, with the onset of new devices like ​wearables​, which includes, ​Smart Watches​, ​Smart
Glasses​, ​VR gears​ etc, the demand for unconventional operating systems is also rising.

Types of Operating Systems


Following are some of the most widely used types of Operating system.

1. Simple Batch System

2. Multiprogramming Batch System

3. Multiprocessor System

4. Desktop System

5. Distributed Operating System

6. Clustered System

7. Realtime Operating System

8. Handheld System

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 7
Simple Batch Systems
● In this type of system, there is ​no direct interaction between user and the

computer​.

● The user has to submit a job (written on cards or tape) to a computer operator.

● Then computer operator places a batch of several jobs on an input device.

● Jobs are batched together by type of languages and requirement.

● Then a special program, the monitor, manages the execution of each program in the

batch.

● The monitor is always in the main memory and available for execution.

Advantages of Simple Batch Systems

1. No interaction between user and computer.

2. No mechanism to prioritise the processes.

Multi-User Operating Systems

A multi-user operating system allows many different users to take advantage


of the computer's resources simultaneously. The operating system must make

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 8
sure that the requirements of the various users are balanced, and that each of
the programs they are using has sufficient and separate resources so that a
problem with one user doesn't affect the entire community of users. Unix,
VMS and mainframe operating systems, such as ​MVS,​ are examples of
multi-user operating systems.

It's important to differentiate between multi-user operating systems and


single-user operating systems that support networking. Windows 2000 and
Novell Netware can each support hundreds or thousands of networked users, but
the operating systems themselves aren't true multi-user operating systems.

Functions of the Operating System

Bootstrap process

A bootstrap is the program that initializes the operating system (OS) during startup.

Bootstrapping is the process of loading a set of instructions when a computer is first turned on
or booted. During the startup process, diagnostic tests are performed, such as the power-on
self-test (POST), that set or check configurations for devices and implement routine testing for
the connection of peripherals, hardware and external memory devices. The bootloader or
bootstrap program is then loaded to initialize the OS.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 9
Process Management
A process is a program in execution. Process is not as same as program code but a lot more
than it. A process is an 'active' entity as opposed to program which is considered to be a
'passive' entity. Attributes held by process include hardware state, memory, CPU etc.

Process states
● NEW​- The process is being created.

● READY​- The process is waiting to be assigned to a processor.

● RUNNING​- Instructions are being executed.

● BLOCKED​- The process is waiting for some event to occur(such as an I/O completion

or reception of a signal).

● TERMINATED​- The process has finished execution.

Process Control Block


There is a Process Control Block for each process, enclosing all the information about the
process. It is a data structure, which contains the following:

● Process State​: It can be running, waiting etc.

● Process ID​ and the ​parent process ID​.

● CPU registers and Program Counter. ​Program Counter​ holds the address of the

next instruction to be executed for that process.

● CPU Scheduling​ information: Such as priority information and pointers to

scheduling queues.

● Memory Management information​: For example, page tables or segment tables.

● Accounting information​: The User and kernel CPU time consumed, account

numbers, limits, etc.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 10
● I/O Status information​: Devices allocated, open file tables, etc.

What is a Deadlock?
Deadlocks are a set of blocked processes each holding a resource and waiting to acquire a
resource held by another process.

How to avoid deadlocks


Deadlocks can be avoided by avoiding at least one of the four conditions, because all this four
conditions are required simultaneously to cause deadlock.

Mutual Exclusion
Resources shared such as read-only files do not lead to deadlocks but resources, such as
printers and tape drives, requires exclusive access by a single process.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 11
Hold and Wait
In this condition processes must be prevented from holding one or more resources while
simultaneously waiting for one or more others.

No Preemption
Preemption of process resource allocations can avoid the condition of deadlocks, where ever
possible.

Circular Wait
Circular wait can be avoided if we number all resources, and require that processes request
resources only in strictly increasing(or decreasing) order.

Handling deadlock
The above points focus on preventing deadlocks. But what to do once a deadlock has occured.
Following three strategies can be used to remove deadlock after its occurrence.

Preemption
We can take a resource from one process and give it to other. This will resolve the deadlock
situation, but sometimes it does causes problems.

Rollback
In situations where deadlock is a real possibility, the system can periodically make a record of
the state of each process and when deadlock occurs, roll everything back to the last checkpoint,
and restart, but allocating resources differently so that deadlock does not occur.

Kill one or more processes


This is the simplest way, but it works.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 12
Process Scheduling & Scheduling Algorithms
The act of determining which process is in the ​ready​ state, and should be moved to the
running​ state is known as ​Process Scheduling​.

The prime aim of the process scheduling system is to keep the CPU busy all the time and to
deliver minimum response time for all programs. For achieving this, the scheduler must apply
appropriate rules for swapping processes ​IN​ and ​OUT​ of CPU.

Scheduling fell into one of the two general categories:

● Non Pre-emptive Scheduling:​ When the currently executing process gives up the

CPU voluntarily.

● Pre-emptive Scheduling:​ When the operating system decides to favour another

process, pre-empting the currently executing process.

Pre-emptive
● Shortest-Job-First (SJF),
● round robin

Non-pre-emptive
● First come first serve (FCFS),
● Shortest-Job- First (SJF)

Throughput

It is the total number of processes completed per unit time or rather say total amount of work
done in a unit of time. This may range from 10/second to 1/hour depending on the specific
processes.

Turnaround Time

It is the amount of time taken to execute a particular process, i.e. The interval from time of
submission of the process to the time of completion of the process(Wall clock time).

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 13
Waiting Time

The sum of the periods spent waiting in the ready queue amount of time a process has been
waiting in the ready queue to acquire get control on the CPU.

Load Average

It is the average number of processes residing in the ready queue waiting for their turn to get
into the CPU.

Response Time

Amount of time it takes from when a request was submitted until the first response is produced.
Remember, it is the time till the first response and not the completion of process execution(final
response).

In general CPU utilization and Throughput are maximized and other factors are reduced for
proper optimization.

Scheduling Algorithms

The method used to determine which of several processes, each of which can safely have a
resource allocated to it, will actually be granted use of the resource. The algorithm may take into
account the priority of the user associated with the process, the requirement to maintain high
utilization of system resources, and deadlines for the job.

Aim of scheduling
● Max CPU utilization [Keep CPU as busy as possible]
● Fair allocation of CPU.
● Max throughput [Number of processes that complete their execution per time unit]
● Min turnaround time [Time taken by a process to finish execution]
● Min waiting time [Time a process waits in ready queue]
● Min response time [Time when a process produces first response]
● No task must be starved of resources - all tasks must get their chance at CPU time;
● If using priorities, a low-priority task must not hold up a high-priority task;
● the scheduler must scale well with a growing number of tasks, ideally being O(1). This
has been done, for example, in the Linux kernel.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 14
Shortest Job First(SJF) Scheduling
Shortest Job First scheduling works on the process with the shortest burst time or duration first.
● This is the best approach to minimize waiting time.
● This is used in Batch Systems.
● It is of two types:
1. Non-pre-emptive
2. Pre-emptive
● To successfully implement it, the burst time/duration time of the processes should be
known to the processor in advance, which is practically not feasible all the time.
● This scheduling algorithm is optimal if all the jobs/processes are available at the same
time. (either Arrival time is 0 for all, or Arrival time is same for all)

Problem with Non-pre-emptive SJF


If the arrival time for processes are different, which means all the processes are not available in
the ready queue at time 0, and some jobs arrive after some time, in such situation, sometimes
process with short burst time have to wait for the current process's execution to finish, because
in Non Pre-emptive SJF, on arrival of a process with short duration, the existing job/process'
execution is not halted/stopped to execute the short job first.
This leads to the problem of Starvation, where a shorter process has to wait for a long time until
the current longer process gets executed. This happens if shorter jobs keep coming, but this
can be solved using the concept of aging.

Pre-emptive Shortest Job First


In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive, but
as a process with short burst time arrives, the existing process is preempted or removed from
execution, and the shorter job is executed first.

Round Robin Scheduling


Round Robin is the simplest algorithm for a preemptive scheduler. Only a single queue of
processes is used. When the system timer fires, the next process in the queue is switched to,
and the preempted process is put back into the queue.
● A fixed time is allotted to each process, called quantum, for execution.
● Once a process is executed for given time period that process is preemptied and other
process executes for given time period.
● Context switching is used to save states of preemptied processes.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 15
First Come First Serve Scheduling
In the "First come first serve" scheduling algorithm, as the name suggests, the process which
arrives first, gets executed first, or we can say that the process which requests the CPU first,
gets the CPU allocated first.
● First Come First Serve, is just like FIFO(First in First out) Queue data structure, where
the data element which is added to the queue first, is the one who leaves the queue first.
● This is used in Batch Systems.
● It's easy to understand and implement programmatically, using a Queue data structure,
where a new process enters through the tail of the queue, and the scheduler selects
process from the head of the queue.
● A perfect real life example of FCFS scheduling is buying tickets at ticket counter.

Problems with FCFS Scheduling


Below we have a few shortcomings or problems with the FCFS scheduling algorithm:
1. It is Non Pre-emptive algorithm, which means the process priority doesn't matter.
2. If a process with very least priority is being executed, more like daily routine backup
process, which takes more time, and all of a sudden some other high priority process
arrives, like interrupt to avoid system crash, the high priority process will have to wait,
and hence in this case, the system will crash, just because of improper process
scheduling.
3. Not optimal Average Waiting Time.
4. Resources utilization in parallel is not possible, which leads to Convoy Effect, and hence
poor resource(CPU, I/O etc) utilization.

What is Convoy Effect?


Convoy Effect is a situation where many processes, who need to use a resource for short time
are blocked by one process holding that resource for a long time.
This essentially leads to port utilization of resources and hence poor performance.

Priority Scheduling
● Priority is assigned for each process.
● Process with highest priority is executed first and so on.
● Processes with same priority are executed in FCFS manner.
● Priority can be decided based on memory requirements, time requirements or any other
resource requirement.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 16
Comparison of Scheduling Algorithms
By now, you must have understood how CPU can apply different scheduling algorithms to
schedule processes. Now, let us examine the advantages and disadvantages of each
scheduling algorithms that we have studied so far.

First Come First Serve (FCFS)


Let's start with the Advantages:
● FCFS algorithm doesn't include any complex logic, it just puts the process requests in a
queue and executes it one by one.
● Hence, FCFS is pretty simple and easy to implement.
● Eventually, every process will get a chance to run, so starvation doesn't occur.
It's time for the Disadvantages:
● There is no option for pre-emption of a process. If a process is started, then CPU
executes the process until it ends.
● Because there is no pre-emption, if a process executes for a long time, the processes in
the back of the queue will have to wait for a long time before they get a chance to be
executed.

Shortest Job First (SJF)


Starting with the Advantages: of Shortest Job First scheduling algorithm.
● According to the definition, short processes are executed first and then followed by
longer processes.
● The throughput is increased because more processes can be executed in less amount
of time.
And the Disadvantages:
● The time taken by a process must be known by the CPU beforehand, which is not
possible.
● Longer processes will have more waiting time, eventually they'll suffer starvation.
Note: Preemptive Shortest Job First scheduling will have the same advantages and
disadvantages as those for SJF.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 17
Round Robin (RR)
Here are some Advantages: of using the Round Robin Scheduling:
● Each process is served by the CPU for a fixed time quantum, so all processes are given
the same priority.
● Starvation doesn't occur because for each round robin cycle, every process is given a
fixed time to execute. No process is left behind.
and here comes the Disadvantages:
● The throughput in RR largely depends on the choice of the length of the time quantum. If
time quantum is longer than needed, it tends to exhibit the same behavior as FCFS.
● If time quantum is shorter than needed, the number of times that CPU switches from one
process to another process, increases. This leads to decrease in CPU efficiency.

Priority based Scheduling


Advantages of Priority Scheduling:
● The priority of a process can be selected based on memory requirement, time
requirement or user preference. For example, a high end game will have better graphics,
that means the process which updates the screen in a game will have higher priority so
as to achieve better graphics performance.
Some Disadvantages:
● A second scheduling algorithm is required to schedule the processes which have same
priority.
● In preemptive priority scheduling, a higher priority process can execute ahead of an
already executing lower priority process. If lower priority process keeps waiting for higher
priority processes, starvation occurs.

Usage of Scheduling Algorithms in Different Situations


Every scheduling algorithm has a type of a situation where it is the best choice. Let's look at
different such situations:

Situation 1:
The incoming processes are short and there is no need for the processes to execute in a
specific order.
In this case, FCFS works best when compared to SJF and RR because the processes are short
which means that no process will wait for a longer time. When each process is executed one by
one, every process will be executed eventually.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 18
Situation 2:
The processes are a mix of long and short processes and the task will only be completed if all
the processes are executed successfully in a given time.
Round Robin scheduling works efficiently here because it does not cause starvation and also
gives equal time quantum for each process.

Situation 3:
The processes are a mix of user based and kernel based processes.
Priority based scheduling works efficiently in this case because generally kernel based
processes have higher priority when compared to user based processes.
For example, the scheduler itself is a kernel based process, it should run first so that it can
schedule other processes.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 19
Interrupts
In early years of computing, the processor has to wait for the signal for processing. So the
processor has to check if ​each and every hardware and software program in the system​ has
any signal to process. This method of checking the signal in the system for processing is called
Polling Method​. With this method, the problem is that the processor has to waste a number of
clock cycles just for checking the signal, by doing this processor will become busy
unnecessarily. If any signal came for the process, the processor will take some time to process
the signal due to the polling process in action. So the system performance also will degrade and
response time of the system will also increase (it will take longer to respond).
To overcome this problem, engineers introduced a new mechanism. In this mechanism the
processor will not check for any signal from hardware or software but instead hardware/software
will notify (send a signal to) the processor that it has data for processing. The signal from
hardware or software should have highest priority because the processor should leave the
current process and process the signal of hardware or software. This mechanism of processing
the signal is called ​Interrupt ​of the system.

What is an Interrupt?
Interrupt is a signal which has highest priority from hardware or software which processor
should process its signal immediately.

Types of Interrupts:
Although interrupts have highest priority than other signals, there are many type of interrupts but
basic type of interrupts are
1. Hardware Interrupts: If the signal for the processor is from external device or hardware is
called hardware interrupts. Example: from keyboard we will press the key to do some
action this pressing of key in keyboard will generate a signal which is given to the
processor to do action, such interrupts are called hardware interrupts. Hardware
interrupts can be classified into two types they are
● Maskable Interrupt: The hardware interrupts which can be delayed when a much
highest priority interrupt has occurred to the processor.
● Non Maskable Interrupt: The hardware which cannot be delayed and should
process by the processor immediately.
2. Software Interrupts: Software interrupt can also divided in to two types. They are
● Normal Interrupts: the interrupts which are caused by the software instructions
are called software instructions.
● Exception: unplanned interrupts while executing a program is called Exception.
For example: while executing a program if we got a value which should be
divided by zero is called a exception.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 20
Interrupt Handling:
We know that instruction cycle consists of​ fetch, decode, execute and read/write functions​. After
every instruction cycle the processor will check for interrupts to be processed if there is no
interrupt is present in the system it will go for the next instruction cycle which is given by the
instruction register.
If there is an interrupt present then it will trigger the interrupt handler, the handler will stop the
present instruction which is processing and save its configuration in a register and load the
program counter of the interrupt from a location which is given by the interrupt vector table. After
processing the interrupt by the processor interrupt handler will load the instruction and its
configuration from the saved register, process will start its processing where it’s left. This saving
the old instruction processing configuration and loading the new interrupt configuration is also
called as context switching.
The ​interrupt handler​ is also called as ​Interrupt service routine ​(ISR). There are different
types of interrupt handler which will handle different interrupts. For example for the clock in a
system will have its interrupt handler, keyboard it will have its interrupt handler for every device
it will have its interrupt handler.
The main features of the ISR are
● Interrupts can occur at any time they are asynchronous. ISR’s can call for asynchronous
interrupts.
● Interrupt service mechanism can call the ISR’s from multiple sources.
● ISR’s can handle both maskable and non maskable interrupts. An instruction in a
program can disable or enable an interrupt handler call.
● ISR on beginning of execution it will disable other devices interrupt services. After
completion of the ISR execution it will re initialize the interrupt services.
● The nested interrupts are allowed in ISR for diversion to other ISR.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 21
Memory Management & Device Management

Memory management is the process of controlling, coordinating, and assigning computer


memory to various running programs to optimize overall system performance.

Virtual Memory
Virtual memory combines active RAM and inactive memory on Secondary Storage to form a
large range of contiguous addresses.
The primary benefits of virtual memory include freeing applications from having to manage a
shared memory space, increased security due to memory isolation, and being able to
conceptually use more memory than might be physically available, using the technique of
paging.

Paging
While copying virtual memory into physical memory, the OS divides memory into pagefiles or
swap files with a fixed number of addresses. Each page is stored on a disk and when the page
is needed, the OS copies it from the disk to main memory and translates the virtual addresses
into real addresses.
The portion of the hard disk that acts as physical memory is called a page file.

A page fault is a type of exception raised by computer hardware when a running program
accesses a memory page that is not currently mapped by the memory management unit (MMU).
Page faults usually indicate the need to allocate more memory.

Thrashing
The computer spends an unsuitably large amount of time transferring pages to and from a
backing store, hence slowing down useful work.

In computer science, thrashing occurs when a computer's virtual memory resources are
overused, leading to a constant state of paging and page faults, inhibiting most application-level

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 22
processing. This causes the performance of the computer to degrade or collapse. The situation
can continue indefinitely until either the user closes some running applications or the active
processes free up additional virtual memory resources.

Device Management
Device management is the process of managing the implementation, operation
and maintenance of a physical and/or virtual device.

Device drivers
A computer program that operates or controls a particular type of device that is attached to a
computer.
A driver provides a software interface to hardware devices, enabling operating systems and
other computer programs to access hardware functions without needing to know precise details
about the hardware being used.

They provide the interrupt handling required for any necessary asynchronous time-dependent
hardware interface.

Devices, Interrupt handling and the PCB


● PCB is a data structure in the operating system kernel containing the information needed
to manage the scheduling of a particular process.
● An interrupt is a signal to the processor emitted by hardware or software indicating an
event that needs immediate attention.
When a device needs attention or has data it generates an interrupt request.
The OS then pause the running process, updates it PCB (state) and runs the interrupt service
routine (driver).
Once the IRQ has been handled OS returns control to the interrupted process for completion.

Input/output control & peripheral control


Alternatively referred to as an input/output interface, IOC, or PIOC for Peripheral input/output
controller.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 23
The input/output controller is a device that interfaces between an input or output device and the
computer or hardware device.
The input/output controller on a computer is commonly located on the motherboard. However,
an I/O controller can also be an internal add-on that can either be used as a replacement or
allow for additional input or output devices for the computer.
A controller is a chip, an expansion card, or a stand-alone device that interfaces with a
peripheral device.

Polling
This is the continuous checking of other programs or devices by a program or device to see
what state they are in, usually to see whether they are still connected or want to communicate.
In terms of device management, polling is the opposite of interrupting.

disadvantage – if they are too many devices to check, the time required to poll them can exceed
the time available to service the I/O device.

Buffer
This is a memory area that stores data while they are transferred between two devices or
between a device and an application. It is done for three (3) reasons:
● To cope with a speed mismatch between the producer and consumer of a data stream
● To adapt between devices that have different data transfer sizes
● To support copy semantics for application I/O

Spooling
To send (data that is intended for printing or processing on a peripheral device) to an
intermediate store (e.g. buffer).
In contemporary systems it is usually used for mediating between a computer application and a
slow peripheral, such as a printer.
Spooling allows programs to "hand off" work to be done by the peripheral and then proceed to
other tasks, or do not begin until input has been transcribed.
Spooling is a combination of buffering and queueing.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 24
File Management

The OS manages how data is organised into files. This makes it easier for the user to see files
using programs like the Windows File Explorer or Mac OS X Finder. The OS organises where
and how files are stored, deleted, read, found and repaired. It detects errors such as missing
disks or incorrect file names, and informs the user that errors have occurred.

File
A file is a named collection of related information that is recorded on secondary storage such as
magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes,
lines or records whose meaning is defined by the files creator and user.

Directories/Folders
A directory is a location for storing files on your computer. Directories are found in a hierarchical
file system, such as Linux, MS-DOS, OS/2, and Unix. The analogy of calling a directory a folder
came from the file folders used in an office filing system.

Security of files

User IDs
Each file is owned by a user. That user is identified by a User ID. The OS will usually only
permit the file owner or those users designated by the file owner to access a file.

Passwords
A password is a word or string of characters used for user authentication to prove identity or
access approval to gain access to a resource (a file), which is to be kept secret from those not
allowed access. A password is usually combined with some other identified (username, user id)
and is often used as a key to encrypt data.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 25
Lockwords,
In security a lockword is a password associated with a file or data set. The lockword is set by
the owner or creator and must be supplied in order to gain access to the file.
A lockword is different from a password in that it is meant to be shared by all persons who need
to gain access to a file, it is also not usually used to encrypt the file.

Access control list,


ACLs can provide greater control over file permissions when the traditional UNIX file protection
in the UNIX based operating systems is not sufficient. An access control list (ACL), with respect
to a computer file system, is a list of permissions attached to a file. An ACL specifies which
users or system processes are granted access to objects, as well as what operations are
allowed on given file.

File Encryption
File Encryption means providing security for files. Encryption is the process of encoding a file in
such a way that only authorized parties can access it and those who are not authorized cannot.
Encryption does not itself prevent interference, but denies the intelligible content to a would-be
interceptor.

File compression
File compression is a data compression method in which the logical size of a file is reduced to
save disk space for easier and faster transmission over a network or the Internet. It enables the
creation of a version of one or more files with the same data at a size substantially smaller than
the original file.

Activity logs
The operating system keeps a log of every action taken on a file. This log records what was
done, what time and by which user.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 26
User Interface

Command line interface – it requires the user to type in commands using a special language.
This special language makes command-line interfaces difficult to use, especially for new
computer users. An example of a command-line interface is Microsoft Disk Operating System
(MS-DOS).

Menu-driven interface – a menu is a list of options from which you can choose what you want to
do. Application programs use menus as an easy alternative to having to learn program
commands. You can control the computer by choosing commands and available options from a
menu, using the keyboard or a mouse.

Graphical user interface (GUI) – these are provided by the Windows and Macintosh operating
systems. GUIs are presently regarded as the user interfaces which are easiest to use. As a
result, all computers are now supplied with a GUI system installed. The best way to remember
what makes up a GUI is to think of the word ​WIMP​, which stands for Windows, Icons, Menus
and Pointers.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 27
Links and References
https://www.studytonight.com/operating-system/introduction-operating-systems

https://www.studytonight.com/operating-system

https://computer.howstuffworks.com/operating-system3.htm

https://www.techopedia.com/definition/3328/bootstrap

https://www.electronicshub.org/types-of-interrupts-and-how-to-handle-interrupts/

https://whatis.techtarget.com/definition/interrupt

https://www.bbc.com/bitesize/guides/ztcdtfr/revision/6

https://www.computerhope.com/jargon/d/director.htm

http://www.3kranger.com/HP3000/mpeix/en-mpe60/32650-90421/ch06s10.html

https://www.techopedia.com/definition/892/file-compression

Acknowledgement

The information contained herein are not necessarily original works. Much of
the content is widely defined terms and were taken from suitable publicly
available sources. Insofar as necessary the content was changed to suit the
requirements of CAPE Computer Science (2010 Syllabus).

These notes were compiled by Shane Edwards in 2019 for students at Saint
Jago High School.

~~~~~~~~~~
CAPE Unit 2 – Module 3 / Operating Systems / 28

You might also like