C S and Application UNIT-5
C S and Application UNIT-5
2020
System software
The BIOS (basic input/output system) gets the computer system started
after you turn it on and manages the data flow between the operating
system and attached devices such as the hard disk, video adapter,
keyboard, mouse and printer.
The boot program loads the operating system into the computer's main
memory or random access memory (RAM).
Additionally, system software can also include system utilities, such as the
disk defragmenter and System Restore, and development tools, such
as compilers and debuggers.
System software and application programs are the two main types of computer
software. Unlike system software, an application program (often just called an
application or app) performs a particular function for the user. Examples
include browsers, email clients, word processors and spreadsheets.
System Software is a set of programs that control and manage the operations of
computer hardware. It also helps application programs to execute correctly.
System Software are designed to control the operation and extend the processing
functionalities of a computer system. System software makes the operation of a
computer more fast, effective, and secure. Example: Operating system,
programming language, Communication software, etc.
Operating systems:- Operating system software helps you for the effective
utilization of all hardware and software components of a computer system.
Utility programs: - Utility programs are a set of programs that help users in
system maintenance tasks, and in performing tasks of routine nature.
Fast in speed
Less interactive
Smaller in size
Hard to manipulate
Machine language
Since computers are digital devices, they only recognize binary data. Every
program, video, image, and character of text is represented in binary. This
binary data, or machine code, is processed as input by the CPU. The
resulting output is sent to the operating system or an application, which displays
the data visually. For example, the ASCII value for the letter "A" is 01000001 in
machine code, but this data is displayed as "A" on the screen. An image may have
thousands or even millions of binary values that determine the color of each pixel.
Assembly Language
For example the mnemonic add means to add numbers together, and sub means
to subtract the numbers. So if you want to add the numbers 2 and 3 in assembly
language, it would look like this:
add 2, 3, result
Machine language and assembly language are both low-level languages, but
machine code is below assembly in the hierarchy of computer languages.
Assembly language includes human-readable commands, such as mov, add,
and sub, while machine language does not contain any words or even letters.
Some developers manually write assembly language to optimize a program, but
they do not write machine code. Only developers who write software compilers
need to worry about machine language.
NOTE: While machine code is technically comprised of binary data, it may also be
represented in hexadecimal values. For example, the letter "Z," which
is 01011010 in binary, may be displayed as 5A in hexadecimal code.
The high level language is simple and easy to understand and it is similar to
English language. For example, COBOL, FORTRAN, BASIC, C, C+, Python, etc.
Although a high-level language has many benefits, yet it also has a drawback. It
has poor control on machine/hardware.
To get a flavor of what a high-level language actually looks like, consider an ATM
machine where someone wants to make a withdrawal of $100. This amount
needs to be compared to the account balance to make sure there are enough
funds. The instruction in a high-level computer language would look something
like this:
x = 100
if balance x:
print 'Insufficient balance'
else:
print 'Please take your money'
This is not exactly how real people communicate, but it is much easier to follow
than a series of 1s and 0s in binary code.
The second advantage is that the code of most high-level languages is portable
and the same code can run on different hardware. Both machine code and
assembly languages are hardware specific and not portable. This means that the
machine code used to run a program on one specific computer needs to be
modified to run on another computer. Portable code in a high-level language can
run on multiple computer systems without modification. However, modifications
to code in high-level languages may be necessary because of the operating
system. For example, programs written for Windows typically don't run on a Mac.
Imperative Language: ?
Compiler
A compiler should comply with the syntax rule of that programming language in
which it is written. However, the compiler is only a program and cannot fix errors
found in that program. So, if you make a mistake, you need to make changes in
the syntax of your program. Otherwise, it will not compile.
Interpreter
Basis of
Compiler Interpreter
difference
Basis of
Compiler Interpreter
difference
Running time Compiled code run faster Interpreted code run slower
It is based on language
Model translationlinking-loading It is based on Interpretation Method.
model.
Program execution is
separate from the Program Execution is a part
Execution compilation. It performed ofInterpretation process, so it is
only after the entire output performed line by line.
program is compiled.
Target program
Memory The interpreter exists in the memory
executeindependently and
10 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
Basis of
Compiler Interpreter
difference
Difficult to implement as
Dynamic Interpreted languages support
compilers cannot predict
Typing Dynamic Typing
what happens at turn time.
It is best suited for the It is best suited for the program and
Usage
Production Environment developmentenvironment.
Basis of
Compiler Interpreter
difference
Pertaining
C,C++,C#, Scala, Java all use
Programming PHP, Perl, Ruby uses an interpreter.
complier.
languages
Role of Compiler
Role of Interpreter
The interpreter converts the source code line-by-line during RUN Time.
Relatively less time spent for analyzing and processing the program
HIGH-LEVEL LANGUAGES
High-level languages, like C, C++, JAVA, etc., are very near to English. It makes
programming process easy. However, it must be translated into machine language
before execution. This translation process is either conducted by either a compiler
or an interpreter. Also known as source code.
MACHINE CODE
Machine languages are very close to the hardware. Every computer has its
machine language. A machine language programs are made up of series of binary
pattern. (Eg. 110110) It represents the simple operations which should be
performed by the computer. Machine language programs are executable so that
they can be run directly.
OBJECT CODE
Linking and Loading are the utility programs that play a important role in the
execution of a program. Linking intakes the object codes generated by the
assembler and combines them to generate the executable module. On the other
hand, the loading loads this executable module to the main memory for
execution.
Loading:
Bringing the program from secondary memory to main memory is called Loading.
Linking:
Establishing the linking between all the modules or all the functions of the
program in order to continue the program execution is called linking.
Linking is performed at both compile time, when the source code is translated
into machine code and load time, when the program is loaded into memory by
the loader. Linking is performed at the last step in compiling a program.
Source code -> compiler -> Assembler -> Object code -> Linker -> Executable file ->
Loader
The linker copy all library routines used in the program into executable image. As
a result, it require more memory space. As it does not require the presence of
library on the system when it is run . so, it is faster and more portable. No failure
chance and less error chance.
2. Dynamic linking – Dynamic linking is performed during the run time. This
linking is accomplished by placing the name of a shareable library in the
executable image. There is more chances of error and failure chances. It require
less memory space as multiple program can share a single copy of the library.
Here we can perform code sharing. it means we are using a same object a number
of times in the program. Instead of linking same object again and again into the
library, each module share information of a object with other module having
same object. The shared library needed in the linking is stored in virtual memory
to save RAM. In this linking we can also relocate the code for the smooth running
of code but all the code is not relocatable.It fixes the address at run time.
1. The key difference between linking and loading is that the linking generates
the executable file of a program whereas, the loading loads the executable
file obtained from the linking into main memory for execution.
STATIC DYNAMIC
STATIC DYNAMIC
Macros
Example
int 80h
%endmacro
section .text
global _start ;must be declared for using gcc
section .data
msg1 db 'Hello, programmers!',0xA,0xD
len1 equ $ - msg1
Debugger
A debugger is a software program used to test and find bugs (errors) in other
programs.
When a program crashes, debuggers show the position of the error in the target
program. Most debuggers also are capable of running programs in a step-by-step
mode, besides stopping on specific points. They also can often modify the state of
programs while they are running.
Even the most experienced software programmers usually don't get it right on
their first try. Certain errors, often called bugs, can occur in programs, causing
them to not function as the programmer expected. Sometimes these errors are
easy to fix, while some bugs are very difficult to trace. This is especially true for
large programs that consist of several thousand lines of code.
Fortunately, there are programs called debuggers that help software developers
find and eliminate bugs while they are writing programs. A debugger tells the
programmer what types of errors it finds and often marks the exact lines of code
where the bugs are found. Debuggers also allow programmers to run a program
step by step so that they can determine exactly when and why a program crashes.
Advanced debuggers provide detailed information about threads and memory
being used by the program during each step of execution. You could say a
powerful debugger program is like OFF! with 100% deet.
Operating System
Definition
An operating system is a program that acts as an interface between the user and
the computer hardware and controls the execution of all kinds of programs.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Following are some of the important activities that an Operating System performs
−
Job accounting − Keeping track of time and resources used by various jobs
and users.
Simple Structure
There are many operating systems that have a rather simple structure. These
started as small systems and rapidly expanded much further than their scope. A
common example of this is MS-DOS. It was designed simply for a niche amount
for people. There was no indication that it would become so popular.
It is better that operating systems have a modular structure, unlike MS-DOS. That
would lead to greater control over the computer system and its various
applications. The modular structure would also allow the programmers to hide
information as required and implement internal routines as they see fit without
changing the outer specifications.
Layered Structure
One way to achieve modularity in the operating system is the layered approach.
In this, the bottom layer is the hardware and the topmost layer is the user
interface.
As seen from the image, each upper layer is built on the bottom layer. All the
layers hide some structures, operations etc from their upper layers.
One problem with the layered structure is that each layer needs to be carefully
defined. This is necessary because the upper layers can only use the
functionalities of the layers below them.
o execute programs
o define and communicate asynchronous events
o define and process system clock operations
o implement security features
o manage files and directories, and
o control input/output processing to and from peripheral devices.
o editing files
o searching patterns
o evaluating expressions
o logging messages
o sorting data
Batch processing services support the capability to queue work (jobs) and
manage the sequencing of processing based on job control commands and
lists of data. These services also include support for the management of the
output of batch processing, which frequently includes updated files or
File and directory synchronization services allow local and remote copies
of files and directories to be made identical. Synchronization services are
usually used to update files after periods of off line working on a portable
system.
The major operations of the operating system are process management, memory
management, device management and file management. These are given in detail
as follows:
Process Management
The operating system is responsible for managing the processes i.e assigning the
processor to a process at a time. This is known as process scheduling. The
different algorithms used for process scheduling are FCFS (first come first served),
SJF (shortest job first), priority scheduling, round robin scheduling etc.
There are many scheduling queues that are used to handle processes in process
management. When the processes enter the system, they are put into the job
queue. The processes that are ready to execute in the main memory are kept in
the ready queue. The processes that are waiting for the I/O device are kept in the
device queue.
Memory Management
The activities performed by the operating system for memory management are −
All the memory is tracked by the operating system i.e. it nodes what
memory parts are in use by the processes and which are empty.
Device Management
There are many I/O devices handled by the operating system such as mouse,
keyboard, disk drive etc. There are different device drivers that can be connected
to the operating system to handle a specific device. The device controller is an
interface between the device and the device driver. The user applications can
access all the I/O devices using the device drivers, which are device specific codes.
File Management
Files are used to provide a uniform view of data storage by the operating system.
All the files are mapped onto physical devices that are usually non volatile so data
is safe in the case of system failure.
The files can be accessed by the system in two ways i.e. sequential access and
direct access −
Sequential Access
The information in a file is processed in order using sequential access. The files
records are accessed on after another. Most of the file systems such as editors,
compilers etc. use sequential access.
Direct Access
In direct access or relative access, the files can be accessed in random for read
and write operations. The direct access model is based on the disk model of a file,
since it allows random accesses.
System Calls
4. Device handling(I/O)
5. Protection
6. Networking, etc.
3. Device management
4. Information maintenance
5. Communication
WINDOWS UNIX
CreateProcess() fork()
ExitProcess() exit()
Process Control WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
WriteFile() write()
File Manipulation CloseHandle() close()
SetConsoleMode() ioctl()
ReadConsole() read()
Device Manipulation WriteConsole() write()
GetCurrentProcessID() getpid()
Information SetTimer() alarm()
Maintenance Sleep() sleep()
CreatePipe() pipe()
CreateFileMapping() shmget()
Communication MapViewOfFile() mmap()
SetFileSecurity() chmod()
InitlializeSecurityDescriptor() umask()
Protection SetSecurityDescriptorGroup() chown()
There are many problems that can occur while designing and implementing an
operating system. These are covered in operating system design and
implementation.
It is quite complicated to define all the goals and specifications of the operating
system while designing it.The design changes depending on the type of the
operating system i.e if it is batch system, time shared system, single user system,
multi user system, distributed system etc.
There are basically two types of goals while designing an operating system. These
are −
User Goals
The operating system should be convenient, easy to use, reliable, safe and fast
according to the users. However, these specifications are not very useful as there
is no set method to achieve these goals.
System Goals
The operating system should be easy to design, implement and maintain. These
are specifications required by those who create, maintain and operate the
operating system. But there is not specific method to achieve these goals as well.
A subtle difference between mechanism and policy is that mechanism shows how
to do something and policy shows what to do. Policies may change over time and
this would lead to changes in mechanism. So, it is better to have a general
mechanism that would require few changes even when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are
required in mechanism if policy changes. If a policy favours I/O intensive
processes over CPU intensive processes, then a policy change to preference of
CPU intensive processes will not change the mechanism.
Using high level language for implementing an operating system leads to a loss in
speed and increase in storage requirements. However in modern systems only a
small amount of code is needed for high performance, such as the CPU scheduler
and memory manager. Also, the bottleneck routines in the system can be
replaced by assembly language equivalents if required.
System Boot
Booting the system is done by loading the kernel into main memory, and starting
its execution.
The CPU is given a reset event, and the instruction register is loaded with a
predefined memory location, where execution starts.
The following diagram demonstrates the steps involved in a system boot process
−
The CPU initializes itself after the power in the computer is first turned on.
This is done by triggering a series of clock ticks that are generated by the
system clock.
After this, the CPU looks for the system’s ROM BIOS to obtain the first
instruction in the start-up program. This first instruction is stored in the
ROM BIOS and it instructs the system to run POST (Power On Self Test) in a
memory address that is predetermined.
POST first checks the BIOS chip and then the CMOS RAM. If there is no
battery failure detected by POST, then it continues to initialize the CPU.
POST also checks the hardware devices, secondary storage devices such as
hard drives, ports etc. And other hardware devices such as the mouse and
keyboard. This is done to make sure they are working properly.
After POST makes sure that all the components are working properly, then
the BIOS finds an operating system to load.
In most computer system’s, the operating system loads from the C drive
onto the hard drive. The CMOS chip typically tells the BIOS where the
operating system is found.
The order of the different drives that CMOS looks at while finding the
operating system is known as the boot sequence. This sequence can be
changed by changing the CMOS setup.
After finding the appropriate boot drive, the BIOS first finds the boot record
which tells it to find the beginning of the operating system.
After the initialization of the operating system, the BIOS copies the files into
the memory. Then the operating system controls the boot process.
In the end, the operating system does a final inventory of the system
memory and loads the device drivers needed to control the peripheral
devices.
The users can access the system applications to perform various tasks.
Without the system boot process, the computer users would have to download all
the software components, including the ones not frequently required. With the
system boot, only those software components need to be downloaded that are
legitimately required and all extraneous components are not required. This
process frees up a lot of space in the memory and consequently saves a lot of
time.
Process
To put it in simple terms, we write our computer programs in a text file and when
we execute this program, it becomes a process which performs all the tasks
mentioned in the program.
When a program is loaded into the memory and it becomes a process, it can be
divided into four sections ─ stack, heap, text and data. The following image shows
a simplified layout of a process inside main memory −
1 Stack
2 Heap
3 Text
4 Data
Program
#include <stdio.h>
int main() {
return 0;
When a process executes, it passes through different states. These stages may
differ in different operating systems, and the names of these states are also not
standardized.
In general, a process can have one of the following five states at a time.
1 Start
2 Ready
3 Running
4 Waiting
Process moves into the waiting state if it needs to wait for a resource,
such as waiting for user input, or waiting for a file to become available.
5 Terminated or Exit
1 Process State
The current state of the process i.e., whether it is ready, running, waiting,
or whatever.
2 Process privileges
3 Process ID
4 Pointer
5 Program Counter
6 CPU registers
Various CPU registers where process need to be stored for execution for
running state.
This includes the information of page table, memory limits, Segment table
depending on memory used by the operating system.
9 Accounting information
This includes the amount of CPU used for process execution, time limits,
execution ID etc.
10 IO status information
The PCB is maintained for a process throughout its lifetime, and is deleted once
the process terminates.
Process Scheduling
The process scheduling is the activity of the process manager that handles the
removal of the running process from the CPU and the selection of another
process on the basis of a particular strategy.
41 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
Job queue − This queue keeps all the processes in the system.
Ready queue − This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.
The OS can use different policies to manage each queue (FIFO, Round Robin,
Priority, etc.). The OS scheduler determines how to move processes between the
ready and run queues which can only have one entry per processor core on the
system; in the above diagram, it has been merged with the CPU.
Two-state process model refers to running and non-running states which are
described below −
1 Running
When a new process is created, it enters into the system as in the running
state.
2 Not Running
Processes that are not running are kept in queue, waiting for their turn to
execute. Each entry in the queue is a pointer to a particular process. Queue
is implemented by using linked list. Use of dispatcher is as follows. When a
process is interrupted, that process is transferred in the waiting queue. If
the process has completed or aborted, the process is discarded. In either
case, the dispatcher then selects a process from the queue to execute.
Schedulers
Long-Term Scheduler
Short-Term Scheduler
Medium-Term Scheduler
The primary objective of the job scheduler is to provide a balanced mix of jobs,
such as I/O bound and processor bound. It also controls the degree of
multiprogramming. If the degree of multiprogramming is stable, then the average
rate of process creation must be equal to the average departure rate of processes
leaving the system.
Context Switch
A context switch is the mechanism to store and restore the state or context of a
CPU in Process Control block so that a process execution can be resumed from
45 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
the same point at a later time. Using this technique, a context switcher enables
multiple processes to share a single CPU. Context switching is an essential part of
a multitasking operating system features.
When the scheduler switches the CPU from executing one process to execute
another, the state from the current running process is stored into the process
control block. After this, the state for the process to run next is loaded from its
own PCB and used to set the PC, registers, etc. At that point, the second process
can start executing.
Context switches are computationally intensive since register and memory state
must be saved and restored. To avoid the amount of context switching time,
some hardware systems employ two or more sets of processor registers. When
the process is switched, the following information is stored for later use.
Program Counter
Scheduling information
Changed State
Accounting information
Process Operations
There are many operations that can be performed on processes. Some of these
are process creation, process preemption, process blocking, and process
termination. These are given in detail as follows −
Process Creation
Processes need to be created in the system for different operations. This can be
done by the following events −
System initialization
A process may be created by another process using fork(). The creating process is
called the parent process and the created process is the child process. A child
process can have only one parent but a parent process may have many children.
Both the parent and child processes have the same memory image, open files,
and environment strings. However, they have distinct address spaces.
Process Preemption
Process Blocking
The process is blocked if it is waiting for some event to occur. This event may be
I/O as the I/O events are executed in the main memory and don't require the
processor. After the event is complete, the process again goes to the ready state.
Process Termination
After the process has completed the execution of its last instruction, it is
terminated. The resources held by a process are released after it is terminated.
A child process can be terminated by its parent process if its task is no longer
relevant. The child process sends its status information to the parent process
before it terminates. Also, when a parent process is terminated, its child
processes are terminated as well as the child processes cannot run if the parent
processes are terminated.
Independent process.
Co-operating process.
1. Shared Memory
2. Message passing
#define buff_max 25
#define mod %
struct item{
// or consumed data
---------
int free_index = 0;
int full_index = 0;
item nextProduced;
while(1){
// for production.
// if so keep waiting.
shared_buff[free_index] = nextProduced;
item nextConsumed;
while(1){
while((free_index == full_index);
nextConsumed = shared_buff[full_index];
In the above code, the Producer will start producing again when the
(free_index+1) mod buff max will be free because if it it not free, this implies that
there are still items that can be consumed by the Consumer so there is no need to
produce more. Similarly, if free index and full index point to the same index, this
implies that there are no items to consume.
Now, We will start our discussion of the communication between processes via
message passing. In this method, processes communicate with each other
without using any kind of shared memory. If two processes p1 and p2 want to
communicate with each other, they proceed as follows:
The message size can be of fixed size or of variable size. If it is of fixed size, it is
easy for an OS designer but complicated for a programmer and if it is of variable
size then it is easy for a programmer but complicated for the OS designer. A
standard message can have two parts: header and body.
The header part is used for storing message type, destination id, source id,
4. What is the capacity of a link? Is the size of a message that the link can
accommodate fixed or variable?
A link has some capacity that determines the number of messages that can reside
in it temporarily for which every link has a queue associated with it which can be
of zero capacity, bounded capacity, or unbounded capacity. In zero capacity, the
sender waits until the receiver informs the sender that it has received the
message. In non-zero capacity cases, a process does not know whether a message
has been received or not after the send operation. For this, the sender must
communicate with the receiver explicitly. Implementation of the link depends on
the situation, it can be either a direct communication link or an in-directed
communication link.
Direct Communication links are implemented when the processes uses a specific
process identifier for the communication, but it is hard to identify the sender
ahead of time.
For example: the print server.
the sender about the receiver. A mailbox can be made private to a single
sender/receiver pair and can also be shared between multiple sender/receiver
pairs. Port is an implementation of such mailbox which can have multiple sender
and single receiver. It is used in client/server applications (in this case the server is
the receiver). The port is owned by the receiving process and created by OS on
the request of the receiver process and can be destroyed either on request of the
same receiver process or when the receiver terminates itself. Enforcing that only
one process is allowed to execute the receive can be done using the concept of
mutual exclusion. Mutex mailbox is create which is shared by n process. Sender is
non-blocking and sends the message. The first process which executes the receive
will enter in the critical section and all other processes will be blocking and will
wait.
Producer Code
void Producer(void){
int item;
Message m;
while(1){
receive(Consumer, &m);
item = produce();
build_message(&m , item ) ;
send(Consumer, &m);
Consumer Code
filter_none
edit
play_arrow
brightness_4
void Consumer(void){
int item;
Message m;
while(1){
receive(Producer, &m);
item = extracted_item();
send(Producer, &m);
consume_item(item);
Pipe
Socket
The above three methods will be discussed in later articles as all of them are quite
conceptual and deserve their own separate articles.
There are three main methods to client/server communication. These are given as
follows −
Sockets
These are interprocess communication techniques that are used for client-server
based applications. A remote procedure call is also known as a subroutine call or a
function call.
A client has a request that the RPC translates and sends to the server. This
request may be a procedure or a function call to a remote server. When the
server receives the request, it sends the required response back to the client.
Pipes
These are interprocess communication methods that contain two end points.
Data is entered from one end of the pipe by a process and consumed from the
other end by the other process.
The two different types of pipes are ordinary pipes and named pipes. Ordinary
pipes only allow one way communication. For two way communication, two pipes
are required. Ordinary pipes have a parent child relationship between the
processes as the pipes can only be accessed by processes that created or
inherited them.
Named pipes are more powerful than ordinary pipes and allow two way
communication. These pipes exist even after the processes using them have
terminated. They need to be explicitly deleted when not required anymore.
Process Synchronization
A Critical Section is a code segment that accesses shared variables and has to be
executed as an atomic action. It means that in a group of cooperating processes,
at a given point of time, only one process must be executing its critical section. If
any other process also wants to execute its critical section, it must wait until the
first one finishes.
A solution to the critical section problem must satisfy the following three
conditions:
1. Mutual Exclusion
Out of a group of cooperating processes, only one process can be in its critical
section at a given point of time.
2. Progress
If no process is in its critical section, and if one or more threads want to execute
their critical section then any one of these threads must be allowed to get into its
critical section.
3. Bounded Waiting
After a process makes a request for getting into its critical section, there is a limit
for how many other processes can get into their critical section, before this
process's request is granted. So after the limit is reached, system must grant the
process permission to get into its critical section.
Synchronization Hardware
Many systems provide hardware support for critical section code. The critical
section problem could be solved easily in a single-processor environment if we
could disallow interrupts to occur while a shared variable or resource is being
modified.
In this manner, we could be sure that the current sequence of instructions would
be allowed to execute in order without pre-emption. Unfortunately, this solution
is not feasible in a multiprocessor environment.
This message transmission lag, delays entry of threads into critical section and the
system efficiency decreases.
Mutex Locks
As the resource is locked while a process executes its critical section hence no
other process can access it.
Because the buffer pool has a maximum size, this problem is often called
the Bounded buffer problem.
Solution to this problem is, creating two counting semaphores "full" and
"empty" to keep track of the current number of full and empty buffers
respectively.
There are five philosophers sitting around a table, in which there are five
chopsticks/forks kept beside them and a bowl of rice in the centre, When a
philosopher wants to eat, he uses two chopsticks - one from their left and
one from their right. When a philosopher wants to think, he keeps down
both chopsticks at their original place.
In this problem there are some processes(called readers) that only read the
shared data, and never change it, and there are other
processes(called writers) who may change the data in addition to reading,
or instead of reading it.
The critical section is a code segment where the shared variables can be accessed.
An atomic action is required in a critical section i.e. only one process can execute
in its critical section at a time. All the other processes have to wait to execute in
their critical sections.
In the above diagram, the entry section handles the entry into the critical section.
It acquires the resources needed for execution by the process. The exit section
handles the exit from the critical section. It releases the resources and also
informs the other processes that the critical section is free.
Mutual Exclusion
Mutual exclusion implies that only one process can be inside the critical section at
any time. If any other processes require the critical section, they must wait until it
is free.
Progress
Progress means that if a process is not using the critical section, then it should not
stop any other process from accessing it. In other words, any process can enter a
critical section if it is free.
Bounded Waiting
Bounded waiting means that each process must have a limited waiting time. Itt
should not wait endlessly to access the critical section.
Peterson’s solution
do {
flag[i] = true;
turn = j;
/* critical section */
flag[i] = false;
/* remainder section */
while (true);
int turn;
boolean flag[2];
The variable turn denotes whose turn it is to enter its critical section. I.e., if turn
== i, then process Pi is allowed to execute in its critical section. If a process is
ready to enter its critical section, the flag array is used to indicate that. For E.g., if
flag[i] is true, this value indicates that Pi is ready to enter its critical section. With
an explanation of these data structures complete, we are now ready to describe
the algorithm shown in above. To enter the critical section, process Pi first sets
flag[i] to be true and then sets turn to the value j, thereby asserting that if the
other process wishes to enter the critical section, it can do so. Turn will be set to
both i and j at roughly the same time, if both processes try to enter at the same
time. Only one of these assignments will occur ultimately; the other will occur but
will be overwritten immediately. The final value of turn determines which of the
two processes is allowed to enter its critical section first. We now prove that this
solution is correct. We need to show that −
To prove 1, we note that each Pi enters its critical section only if either flag[j] ==
false or turn == i. Also note that, if both processes can be executing in their critical
sections at the same time, then flag[0] == flag[1] == true. These two observations
indicate that P0 and P1 could not have successfully executed their while
statements at about the same time, since the value of turn can be either 0 or 1
but cannot be both. Hence, one of the processes — say, Pj — must have
successfully executed the while statement, whereas Pi had to execute at least one
additional statement (“turn == j”). However, at that time, flag[j] == true and turn
== j, and this condition will persist as long as Pj is in its critical section; as a result,
mutual exclusion is preserved.
To prove properties 2 and 3, we note that if a process is stuck in the while loop
with the condition flag[j] == true and turn == j, process Pi can be prevented from
entering the critical section only; this loop is the only one possible. flag[j] will be
== false, and Pi can enter its critical section if Pj is not ready to enter the critical
section. If Pj has set, flag[j] = true and is also executing in its while statement,
then either turn == i or turn == j. If turn == i, Pi will enter the critical section then.
Pj will enter the critical section, If turn == j. Although once Pj exits its critical
section, it will reset flag[j] to false, allowing Pi to enter its critical section. Pj must
also set turn to i, if Pj resets flag[j] to true. Hence, since Pi does not change the
value of the variable turn while executing the while statement, Pi will enter the
critical section (progress) after at most one entry by Pj (bounded waiting).
Disadvantage
Peterson’s solution works for two processes, but this solution is best
scheme in user mode for critical section.
Semaphores
Semaphores are integer variables that are used to solve the critical section
problem by using two atomic operations, wait and signal that are used for process
synchronization.
Wait
wait(S)
while (S<=0);
S--;
Signal
signal(S)
S++;
Types of Semaphores
There are two main types of semaphores i.e. counting semaphores and binary
semaphores. Details about these are given as follows −
Counting Semaphores
These are integer value semaphores and have an unrestricted value domain.
These semaphores are used to coordinate the resource access, where the
semaphore count is the number of available resources. If the resources are
added, semaphore count automatically incremented and if the resources are
removed, the count is decremented.
Binary Semaphores
71 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
The binary semaphores are like counting semaphores but their value is restricted
to 0 and 1. The wait operation only works when the semaphore is 1 and the signal
operation succeeds when semaphore is 0. It is sometimes easier to implement
binary semaphores than counting semaphores.
Advantages of Semaphores
Semaphores allow only one process into the critical section. They follow the
mutual exclusion principle strictly and are much more efficient than some
other methods of synchronization.
Disadvantages of Semaphores
Semaphores are impractical for last scale use as their use leads to loss of
modularity. This happens because the wait and signal operations prevent
the creation of a structured layout for the system.
Threads
Thread is an execution unit which consists of its own program counter, a stack,
and a set of registers. Threads are also known as Lightweight processes. Threads
are popular way to improve application through parallelism. The CPU switches
rapidly back and forth among the threads giving illusion that the threads are
running in parallel.
As each thread has its own independent resource for process execution, multpile
processes can be executed parallely by increasing number of threads.
Types of Thread
1. User Threads
2. Kernel Threads
User threads, are above the kernel and without kernel support. These are the
threads that application programmers use in their programs.
Kernel threads are supported within the kernel of the OS itself. All modern OSs
support kernel level threads, allowing the kernel to perform multiple
simultaneous tasks and/or to service multiple kernel system calls simultaneously.
Multithreading Models
The user threads must be mapped to kernel threads, by one of the following
strategies:
In the many to one model, many user-level threads are all mapped onto a
single kernel thread.
The one to one model creates a separate kernel thread to handle each and
every user thread.
Most implementations of this model place a limit on how many threads can
be created.
The many to many model multiplexes any number of user threads onto an
equal or smaller number of kernel threads, combining the best features of
the one-to-one and many-to-one models.
Blocking the kernel system calls does not block the entire process.
Thread libraries provide programmers with API for creation and management of
threads.
Thread libraries may be implemented either in user space or in kernel space. The
user space involves API functions implemented solely within the user space, with
no kernel support. The kernel space involves system calls, and requires a kernel
with thread library support.
3. Java threads: Since Java generally runs on a Java Virtual Machine, the
implementation of threads is based upon whatever OS and hardware the
JVM is running on, i.e. either Pitheads or Win32 threads depending on the
system.
Benefits of Multithreading
76 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
1. Responsiveness
Multithreading Issues
Below we have mentioned a few issues related to multithreading. Well, it's an old
saying, All good things, come at a price.
Thread Cancellation
Signal Handling
Signals are used in UNIX systems to notify a process that a particular event has
occurred. Now in when a Multithreaded process receives a signal, to which thread
it must be delivered? It can be delivered to all, or a single thread.
fork() is a system call executed in the kernel through which a process creates a
copy of itself. Now the problem in Multithreaded process is, if one thread forks,
will the entire process be copied or not?
Security Issues
There are many other issues that you might face in a multithreaded process, but
there are appropriate solutions available for them. Pointing out some issues here
was just to study both sides of the coin.
Multicore programming
Implicit Threading
One way to address the difficulties and better support the design of
multithreaded applications is to transfer the creation and management of
threading from application developers to compilers and run-time libraries. This,
termed implicit threading, is a popular trend today.
Implicit threading is mainly the use of libraries or other language support to hide
the management of threads. The most common implicit threading library is
OpenMP, in context of C.
OpenMP is a set of compiler directives as well as an API for programs written in C,
C++, or FORTRAN that provides support for parallel programming in shared-
memory environments. OpenMP identifies parallel regions as blocks of code that
may run in parallel. Application developers insert compiler directives into their
code at parallel regions, and these directives instruct the OpenMP run-time
library to execute the region in parallel. The following C program illustrates a
compiler directive above the parallel region containing the printf() statement:
Example
#include <omp.h>
#include <stdio.h>
/* sequential code */
/* sequential code */
return 0;
Output
I am a parallel region.
It creates as many threads which are processing cores in the system. Thus, for a
dual-core system, two threads are created, for a quad-core system, four are
created; and so forth. Then all the threads simultaneously execute the parallel
region. When each thread exits the parallel region, it is terminated. OpenMP
provides several additional directives for running code regions in parallel,
including parallelizing loops.
In addition to providing directives for parallelization, OpenMP allows developers
to choose among several levels of parallelism. Eg, they can set the number of
threads manually. It also allows developers to identify whether data are shared
between threads or are private to a thread. OpenMP is available on several open-
source and commercial compilers for Linux, Windows, and Mac OS X systems.
Grand Central Dispatch (GCD)
Grand Central Dispatch (GCD)—a technology for Apple’s Mac OS X and iOS
operating systems—is a combination of extensions to the C language, an API, and
a run-time library that allows application developers to spot sections of code to
run in parallel. Like OpenMP, GCD also manages most of the details of threading.
It identifies extensions to the C and C++ languages known as blocks. A block is
simply a self-contained unit of work. It is specified by a caret ˆ inserted in front of
a pair of braces { }. A simple example of a block is shown below −
{
ˆprintf("This is a block");
}
(known as main queue). Developer can create additional serial queues that are
local to particular processes. Serial queues are useful for ensuring the sequential
execution of several tasks. Blocks placed on a concurrent queue are also removed
in FIFO order, but several blocks may be removed at a time, thus allowing
multiple blocks to execute in parallel. There are three system-wide concurrent
dispatch queues, and they are distinguished according to priority: low, default,
and high. Priorities represent an estimation of the relative importance of blocks.
Quite simply, blocks with a higher priority should be placed on the high priority
dispatch queue. The following code segment illustrates obtaining the default-
priority concurrent queue and submitting a block to the queue using the dispatch
async() function:
dispatch_queue_t queue =
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch async(queue, ˆ{ printf("This is a block."); });
Python Threads
Python additionally provides two mechanisms for multithreading. One approach
is comparable to the Pthread style, wherever a function name is passed to a
library method thread.start_new_thread(). This approach is very much and lacks
the flexibility to join or terminate the thread once it starts. A additional flexible
technique is to use the threading module to outline a class that extends
threading. Thread. almost like the Java approach, the category should have a run()
method that gives the thread's entry purpose. Once an object is instantiated from
this category, it can be explicitly started and joined later.
Concurrency as Language Design
Newer programming languages have avoided race condition by building
assumptions of concurrent execution directly into the language style itself. As an
example, Go combines a trivial implicit threading technique (goroutines) with
channels, a well-defined style of message-passing communication. Rust adopts a
definite threading approach the same as Pthreads. However, Rust has terribly
strong memory protections that need no extra work by the software engineer.
Goroutines
The Go language includes a trivial mechanism for implicit threading: place the
keyword go before a call. The new thread is passed an association to a message-
passing channel. Then, the most thread calls success := <-messages, that performs
a interference scan on the channel. Once the user has entered the right guess of
seven, the keyboard auditor thread writes to the channel, permitting the most
thread to progress.
Channels and goroutines are core components of the Go language, that was
designed beneath the belief that almost all programs would be multithreaded.
This style alternative streamlines the event model, permitting the language itself
up-to-date the responsibility for managing the threads and programing.
Rust Concurrency
Another language is Rust that has been created in recent years, with concurrency
as a central design feature. The following example illustrates the use of
thread::spawn() to create a new thread, which can later be joined by invoking
join() on it. The argument to thread::spawn() beginning at the || is known as a
closure, which can be thought of as an anonymous function. That is, the child
thread here will print the value of a.
Example
use std::thread;
fn main() {
let mut a = 7;
a -= 1;
println!("a = {}", a)
});
a += 1;
child_thread.join();
However, there is a subtle point in this code that is central to Rust's design.
Within the new thread (executing the code in the closure), the a variable is
distinct from the a in other parts of this code. It enforces a very strict memory
one by one −
CPU Scheduling
CPU scheduling is a process which allows one process to use the CPU while the
execution of another process is on hold(in waiting state) due to unavailability of
any resource like I/O etc, thereby making full use of CPU. The aim of CPU
scheduling is to make the system efficient, fast and fair.
Whenever the CPU becomes idle, the operating system must select one of the
processes in the ready queue to be executed. The selection process is carried out
by the short-term scheduler (or CPU scheduler). The scheduler selects from
among the processes in memory that are ready to execute, and allocates the CPU
to one of them.
Switching context
Jumping to the proper location in the user program to restart that program
from where it left last time.
The dispatcher should be as fast as possible, given that it is invoked during every
process switch. The time taken by the dispatcher to stop one process and start
another process is known as the Dispatch Latency. Dispatch Latency can be
explained using the below figure:
CPU scheduling decisions may take place under the following four circumstances:
1. When a process switches from the running state to the waiting state(for
I/O request or invocation of wait for the termination of one of the child
processes).
2. When a process switches from the running state to the ready state (for
example, when an interrupt occurs).
3. When a process switches from the waiting state to the ready state(for
example, completion of I/O).
When Scheduling takes place only under circumstances 1 and 4, we say the
scheduling scheme is non-preemptive; otherwise the scheduling scheme
is preemptive.
Non-Preemptive Scheduling
Under non-preemptive scheduling, once the CPU has been allocated to a process,
the process keeps the CPU until it releases the CPU either by terminating or by
switching to the waiting state.
This scheduling method is used by the Microsoft Windows 3.1 and by the Apple
Macintosh operating systems.
It is the only method that can be used on certain hardware platforms, because It
does not require the special hardware(for example: a timer) needed for
preemptive scheduling.
Preemptive Scheduling
In this type of Scheduling, the tasks are usually assigned with priorities. At times it
is necessary to run a certain task that has a higher priority before another task
although it is running. Therefore, the running task is interrupted for some time
and resumed later when the priority task has finished its execution.
CPU Utilization
To make out the best use of CPU and not to waste any CPU cycle, CPU would be
working most of the time(Ideally 100% of the time). Considering a real system,
CPU usage should range from 40% (lightly loaded) to 90% (heavily loaded.)
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).
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
To decide which process to execute first and which process to execute last to
achieve maximum CPU utilisation, computer scientists have defined some
algorithms, they are:
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.
AWT or Average waiting time is the average of the waiting times of the processes
in the queue, waiting for the scheduler to pick them for execution.
Consider the processes P1, P2, P3, P4 given in the below table, arrives for
execution in the same order, with Arrival Time 0, and given Burst Time, let's find
the average waiting time using the FCFS scheduling algorithm.
For the above given proccesses, first P1 will be provided with the CPU resources,
For process P4 it will be the sum of execution times of P1, P2 and P3.
The GANTT chart above perfectly represents the waiting time for each process.
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.
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.
Completion Time: Time taken for the execution to complete, starting from arrival
time.
Turn Around Time: Time taken to complete after arrival. In simple words, it is the
difference between the Completion time and the Arrival time.
Waiting Time: Total time the process has to wait before it's execution begins. It is
the difference between the Turn Around time and the Burst time of the process.
Shortest Job First scheduling works on the process with the shortest burst
time or duration first.
It is of two types:
1. Non Pre-emptive
2. Pre-emptive
Consider the below processes available in the ready queue for execution,
with arrival time as 0 for all and given burst times.
As we can see in the GANTT chart above, the process P4 will be picked up first as
it has the shortest burst time, then P2, followed by P3 and at last P1.
We scheduled the same set of processes using the First come first serve algorithm
in the previous tutorial, and got average waiting time to be 18.75 ms, whereas
with SJF, the average waiting time comes out 4.5 ms.
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's 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.
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.
As you can see in the GANTT chart above, as P1 arrives first, hence it's execution
starts immediately, but just after 1 ms, process P2 arrives with a burst time of 3
ms which is less than the burst time of P1, hence the process P1(1 ms done, 20 ms
left) is preemptied and process P2 is executed.
As P2 is getting executed, after 1 ms, P3 arrives, but it has a burst time greater
than that of P2, hence execution of P2 continues. But after another
millisecond, P4 arrives with a burst time of 2 ms, as a result P2(2 ms done, 1 ms
left) is preemptied and P4 is executed.
After the completion of P4, process P2 is picked up and finishes, then P2 will get
executed and at last P1.
The Pre-emptive SJF is also known as Shortest Remaining Time First, because at
any given point of time, the job with the shortest remaining time is executed first.
In the Shortest Job First scheduling algorithm, the priority of a process is generally
the inverse of the CPU burst time, i.e. the larger the burst time the lower is the
priority of that process.
In case of priority scheduling the priority is not always set as the inverse of the
CPU burst time, rather it can be internally or externally set, but yes the scheduling
is done on the basis of priority of the process where the process which is most
urgent is processed first, followed by the ones with lesser priority in order.
Whereas, external priorities are set based on criteria outside the operating
system, like the importance of the process, funds paid for the computer resource
use, makrte factor etc.
Consider the below table fo processes with their respective CPU burst times and
the priorities.
As you can see in the GANTT chart that the processes are given CPU time just on
the basis of the priorities.
A process is considered blocked when it is ready to run but has to wait for the
CPU as some other process is running currently.
But in case of priority scheduling if new higher priority processes keeps coming in
the ready queue then the processes waiting in the ready queue with lower
priority may have to wait for long durations before getting the CPU for execution.
In 1973, when the IBM 7904 machine was shut down at MIT, a low-priority
process was found which was submitted in 1967 and had not yet been run.
To prevent starvation of any process, we can use the concept of aging where we
keep on increasing the priority of low-priority process based on the its waiting
time.
For example, if we decide the aging factor to be 0.5 for each day of waiting, then
if a process with priority 20(which is comparitively low priority) comes in the
ready queue. After one day of waiting, its priority is increased to 19.5 and so on.
Doing so, we can ensure that no process will have to wait for indefinite time for
getting CPU time for processing.
Once a process is executed for given time period that process is preemptied
and other process executes for given time period.
Another class of scheduling algorithms has been created for situations in which
processes are easily classified into different groups.
A multi-level queue scheduling algorithm partitions the ready queue into several
separate queues. The processes are permanently assigned to one queue,
generally based on some property of the process, such as memory size, process
priority, or process type. Each queue has its own scheduling algorithm.
For example: separate queues might be used for foreground and background
processes. The foreground queue might be scheduled by Round Robin algorithm,
while the background queue is scheduled by an FCFS algorithm.
1. System Processes
2. Interactive Processes
4. Batch Processes
5. Student Processes
Each queue has absolute priority over lower-priority queues. No process in the
batch queue, for example, could run unless the queues for system processes,
interactive processes, and interactive editing processes were all empty. If an
interactive editing process entered the ready queue while a batch process was
running, the batch process will be preempted.
The method used to determine which queue a process will enter when that
process needs service.
The definition of a multilevel feedback queue scheduler makes it the most general
CPU-scheduling algorithm. It can be configured to match a specific system under
design. Unfortunately, it also requires some means of selecting values for all the
parameters to define the best scheduler. Although a multilevel feedback queue is
the most general scheme, it is also the most complex.
Thread Scheduling
Scheduling of user level threads (ULT) to kernel level threads (KLT) via
leightweight process (LWP) by the application developer.
1. Contention Scope :
The word contention here refers to the competition or fight among the User level
threads to access the kernel resources. Thus, this control defines the extent to
which contention takes place. It is defined by the application developer using the
thread library. Depending upon the extent of contention it is classified as Process
Contention Scope and System Contention Scope.
In this case, the contention for allocation domain takes place as follows,
1. Process P1:
All PCS threads T1, T2, T3 of Process P1 will compete among themselves.
The PCS threads of the same process can share one or more LWP. T1 and T2
share an LWP and T3 are allocated to a separate LWP. Between T1 and T2
allocation of kernel resources via LWP is based on preemptive priority
scheduling by the thread library. A Thread with a high priority will preempt
low priority threads. Whereas, thread T1 of process p1 cannot preempt
thread T3 of process p3 even if the priority of T1 is greater than the priority
of T3. If the priority is equal, then the allocation of ULT to available LWPs is
based on the scheduling policy of threads by the system scheduler(not by
thread library, in this case).
2. Process P2:
Both SCS threads T4 and T5 of process P2 will compete with processes P1 as
a whole and with SCS threads T8, T9, T10 of process P3. The system
scheduler will schedule the kernel resources among P1, T4, T5, T8, T9, T10,
104 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
PCS threads share one or more available LWPs. For every SCS thread, a
separate LWP is associated.For every system call, a separate KLT is created.
The number of KLT and LWPs created highly depends on the number of SCS
threads created. This increases the kernel complexity of handling scheduling
and synchronization. Thereby, results in a limitation over SCS thread
creation, stating that, the number of SCS threads to be smaller than the
number of PCS threads.
If the system has more than one allocation domain, then scheduling and
synchronization of resources becomes more tedious. Issues arise when an
SCS thread is a part of more than one allocation domain, the system has to
handle n number of interfaces.
The second boundary of thread scheduling involves CPU scheduling by the system
scheduler. The scheduler considers each kernel-level thread as a separate process
and provides access to the kernel resources.
Multiple-Processor Scheduling
One approach is when all the scheduling decisions and I/O processing are handled
by a single processor which is called the Master Server and the other processors
executes only the user code. This is simple and reduces the need of data sharing.
This entire scenario is called Asymmetric Multiprocessing.
Processor Affinity –
Processor Affinity means a processes has an affinity for the processor on which it
is currently running.
When a process runs on a specific processor there are certain effects on the cache
memory. The data most recently accessed by the process populate the cache for
the processor and as a result successive memory access by the process are often
satisfied in the cache memory. Now if the process migrates to another processor,
the contents of the cache memory must be invalidated for the first processor and
the cache for the second processor must be repopulated. Because of the high cost
of invalidating and repopulating caches, most of the SMP(symmetric
multiprocessing) systems try to avoid migration of processes from one processor
to another and try to keep a process running on the same processor. This is
known as PROCESSOR AFFINITY.
Load Balancing –
benefits of having more than one processor else one or more processor will sit
idle while other processors have high workloads along with lists of processors
awaiting the CPU.
Multicore Processors –
In multicore processors multiple processor cores are places on the same physical
chip. Each core has a register set to maintain its architectural state and thus
appears to the operating system as a separate physical processor. SMP
systems that use multicore processors are faster and consume less power than
systems in which each processor has its own physical chip.
In this type of multiple-processor scheduling even a single CPU system acts like a
multiple-processor system. In a system with Virtualization, the virtualization
presents one or more virtual CPU to each of virtual machines running on the
system and then schedules the use of physical CPU among the virtual machines.
Most virtualized environments have one host operating system and many guest
operating systems. The host operating system creates and manages the virtual
machines. Each virtual machine has a guest operating system installed and
applications run within that guest.Each guest operating system may be assigned
for specific use cases,applications or users including time sharing or even real-
time operation. Any guest operating-system scheduling algorithm that assumes a
certain amount of progress in a given amount of time will be negatively impacted
by the virtualization. A time sharing operating system tries to allot 100
milliseconds to each time slice to give users a reasonable response time. A given
100 millisecond time slice may take much more than 100 milliseconds of virtual
CPU time. Depending on how busy the system is, the time slice may take a second
or more which results in a very poor response time for users logged into that
virtual machine. The net effect of such scheduling layering is that individual
virtualized operating systems receive only a portion of the available CPU cycles,
even though they believe they are receiving all cycles and that they are scheduling
all of those cycles.Commonly, the time-of-day clocks in virtual machines are
incorrect because timers take no longer to trigger than they would on dedicated
CPU’s.
Real-time systems are systems that carry real-time tasks. These tasks need to be
performed immediately with a certain degree of urgency. In particular, these
tasks are related to control of certain events (or) reacting to them. Real-time tasks
can be classified as hard real-time tasks and soft real-time tasks.
If a preemptive scheduler is used, the real-time task needs to wait until its
corresponding tasks time slice completes. In the case of a non-preemptive
scheduler, even if the highest priority is allocated to the task, it needs to wait until
the completion of the current task. This task can be slow (or) of the lower priority
and can lead to a longer wait.
Deadlock
Deadlocks are a set of blocked processes each holding a resource and waiting to
acquire a resource held by another process.
Deadlocks can be avoided by avoiding at least one of the four conditions, because
all this four conditions are required simultaneously to cause deadlock.
1. 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.
3. No Preemption
4. 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.
1. 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.
2. 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.
What is a Livelock?
Deadlock Characterization
A deadlock happens in operating system when two or more processes need some
resource to complete their execution that is held by the other process.
A deadlock occurs if the four Coffman conditions hold true. But these conditions
are not mutually exclusive. They are given as follows −
Mutual Exclusion
There should be a resource that can only be held by one process at a time. In the
diagram below, there is a single instance of Resource 1 and it is held by Process 1
only.
A process can hold multiple resources and still request more resources from other
processes which are holding them. In the diagram given below, Process 2 holds
Resource 2 and Resource 3 and is requesting the Resource 1 which is held by
Process 1.
No Preemption
Circular Wait
A process is waiting for the resource held by the second process, which is waiting
for the resource held by the third process and so on, till the last process is waiting
for a resource held by the first process. This forms a circular chain. For example:
Process 1 is allocated Resource2 and it is requesting Resource 1. Similarly, Process
2 is allocated Resource 1 and it is requesting Resource 2. This forms a circular wait
loop.
Deadlock Prevention
Eliminate No Preemption
Preempt resources from the process when resources required by other high
priority processes.
For Example, if P1 process is allocated R5 resources, now next time if P1 ask for
R4, R3 lesser than R5 such request will not be granted, only request for resources
more than R5 will be granted.
Deadlock Avoidance
Deadlock avoidance can be done with Banker’s Algorithm.
Banker’s Algorithm
Bankers’s Algorithm is resource allocation and deadlock avoidance algorithm
which test all the request made by processes for resources, it checks for the safe
state, if after granting request system remains in the safe state it allows the
request and if there is no safe state it doesn’t allow the request made by the
process.
Inputs to Banker’s Algorithm:
1. Max need of resources by each process.
2. Currently allocated resources by each process.
3. Max free available resources in the system.
The request will only be granted under the below condition:
1. If the request made by the process is less than equal to max need to that
process.
2. If the request made by the process is less than equal to the freely available
resource in the system.
Example:
Total resources in system:
ABCD
6576
Available system resources are:
ABCD
3112
Processes (currently allocated resources):
ABCD
P1 1 2 2 1
P2 1 0 3 3
P3 1 2 1 0
Processes (maximum resources):
ABCD
P1 3 3 2 2
P2 1 2 3 4
P3 1 3 5 0
Need = maximum resources - currently allocated resources.
Processes (need resources):
ABCD
P1 2 1 0 1
P2 0 2 0 1
P3 0 1 4 0
Note:Deadlock prevention is more strict that Deadlock Avoidance.
Deadlock Detection
In the above diagram, resource 1 and resource 2 have single instances. There is a
cycle R1 → P1 → R2 → P2. So, Deadlock is Confirmed.
Deadlock Recovery
A traditional operating system such as Windows doesn’t deal with deadlock
recovery as it is time and space consuming process. Real-time operating systems
use Deadlock recovery.
Recovery method
1. Killing the process: killing all the process involved in the deadlock. Killing
process one by one. After killing each process check for deadlock again
keep repeating the process till system recover from deadlock.
Memory Management
The process address space is the set of logical addresses that a process references
in its code. For example, when 32-bit addressing is in use, addresses can range
from 0 to 0x7fffffff; that is, 2^31 possible numbers, for a total theoretical size of 2
gigabytes.
The operating system takes care of mapping the logical addresses to physical
addresses at the time of memory allocation to the program. There are three types
of addresses used in a program before and after memory is allocated −
1 Symbolic addresses
The addresses used in a source code. The variable names, constants, and
instruction labels are the basic elements of the symbolic address space.
2 Relative addresses
3 Physical addresses
The loader generates these addresses at the time when a program is loaded
into main memory.
Virtual and physical addresses are the same in compile-time and load-time
address-binding schemes. Virtual and physical addresses differ in execution-time
address-binding scheme.
The runtime mapping from virtual to physical address is done by the memory
management unit (MMU) which is a hardware device. MMU uses following
mechanism to convert virtual address to physical address.
The value in the base register is added to every address generated by a user
process, which is treated as offset at the time it is sent to memory. For
example, if the base register value is 10000, then an attempt by the user to
use address location 100 will be dynamically reallocated to location 10100.
The user program deals with virtual addresses; it never sees the real
physical addresses.
If you are writing a Dynamically loaded program, then your compiler will compile
the program and for all the modules which you want to include dynamically, only
references will be provided and rest of the work will be done at the time of
execution.
At the time of loading, with static loading, the absolute program (and data) is
loaded into memory in order for execution to start.
If you are using dynamic loading, dynamic routines of the library are stored on a
disk in relocatable form and are loaded into memory only when they are needed
by the program.
As explained above, when static linking is used, the linker combines all other
modules needed by a program into a single executable program to avoid any
runtime dependency.
When dynamic linking is used, it is not required to link the actual module or
library with the program, rather a reference to the dynamic module is provided at
the time of compilation and linking. Dynamic Link Libraries (DLL) in Windows and
Shared Objects in Unix are good examples of dynamic libraries.
Swapping
The total time taken by swapping process includes the time it takes to move the
entire process to a secondary disk and then to copy the process back to memory,
as well as the time the process takes to regain main memory.
Assume that the user process is of size 2048KB and on a standard hard disk where
swapping will take place has a data transfer rate around 1 MB per second. The
actual transfer of the 1000K process to or from memory will take
= 2 seconds
= 2000 milliseconds
Now considering in and out time, it will take complete 4000 milliseconds plus
other overhead where the process competes to regain main memory.
Memory Allocation
1 Single-partition allocation
2 Multiple-partition allocation
Fragmentation
As processes are loaded and removed from memory, the free memory space is
broken into little pieces. It happens after sometimes that processes cannot be
allocated to memory blocks considering their small size and memory blocks
remains unused. This problem is known as Fragmentation.
1 External fragmentation
2 Internal fragmentation
The following diagram shows how fragmentation can cause waste of memory and
a compaction technique can be used to create more free memory out of
fragmented memory −
Paging
A computer can address more memory than the amount physically installed on
the system. This extra memory is actually called virtual memory and it is a section
of a hard that's set up to emulate the computer's RAM. Paging technique plays an
important role in implementing virtual memory.
Address Translation
Page address is called logical address and represented by page number and
the offset.
Frame address is called physical address and represented by a frame number and
the offset.
A data structure called page map table is used to keep track of the relation
between a page of a process to a frame in physical memory.
When the system allocates a frame to any page, it translates this logical address
into a physical address and create entry into the page table to be used
throughout execution of the program.
When a process is to be executed, its corresponding pages are loaded into any
available memory frames. Suppose you have a program of 8Kb but your memory
can accommodate only 5Kb at a given point in time, then the paging concept will
come into picture. When a computer runs out of RAM, the operating system (OS)
will move idle or unwanted pages of memory to secondary memory to free up
RAM for other processes and brings them back when needed by the program.
This process continues during the whole execution of the program where the OS
keeps removing idle pages from the main memory and write them onto the
secondary memory and bring them back when required by the program.
Due to equal size of the pages and frames, swapping becomes very easy.
Page table requires extra memory space, so may not be good for a system
having small RAM.
Segmentation
A program segment contains the program's main function, utility functions, data
structures, and so on. The operating system maintains a segment map table for
every process and a list of free memory blocks along with segment numbers, their
size and corresponding memory locations in main memory. For each segment, the
table stores the starting address of the segment and the length of the segment. A
reference to a memory location includes a value that identifies a segment and an
offset.
In the contiguous memory allocation, both the operating system and the user
must reside in the main memory. The main memory is divided into two portions
one portion is for the operating and other is for the user program.
In the contiguous memory allocation when any user process request for the
memory a single section of the contiguous memory block is given to that process
according to its need. We can achieve contiguous memory allocation by dividing
memory into the fixed-sized partition.
A single process is allocated in that fixed sized single partition. But this will
increase the degree of multiprogramming means more than one process in the
main memory that bounds the number of fixed partition done in memory.
Internal fragmentation increases because of the contiguous memory allocation.
In the fixed sized partition the system divides memory into fixed size partition
(may or may not be of the same size) here entire partition is allowed to a process
and if there is some wastage inside the partition is allocated to a process and if
there is some wastage inside the partition then it is called internal fragmentation.
In the variable size partition, the memory is treated as one unit and space
allocated to a process is exactly the same as required and the leftover space can
be reused again.
132 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
Demand Paging
However, deciding, which pages need to be kept in the main memory and which
need to be kept in the secondary memory, is going to be difficult because we
cannot say in advance that a process will require a particular page at particular
time.
Whenever any page is referred for the first time in the main memory, then that
page will be found in the secondary memory.
After that, it may or may not be present in the main memory depending upon the
page replacement algorithm which will be covered later in this tutorial.
If the referred page is not present in the main memory then there will be a miss
and the concept is called Page miss or page fault.
The CPU has to access the missed page from the secondary memory. If the
number of page fault is very high then the effective access time of the system will
become very high.
What is Thrashing?
If the number of page faults is equal to the number of referred pages or the
number of page faults are so high so that the CPU remains busy in just reading the
pages from the secondary memory then the effective access time will be the time
taken by the CPU to read one word from the secondary memory and it will be so
high. The concept is called thrashing.
If the page fault rate is PF %, the time taken in getting a page from the secondary
memory and again restarting is S (service time) and the memory access time is ma
then the effective access time can be given as;
Page Fault – A page fault happens when a running program accesses a memory
page that is mapped into the virtual address space, but not loaded in physical
memory.
Since actual physical memory is much smaller than virtual memory, page faults
happen. In case of page fault, Operating System might have to replace one of the
existing pages with the newly needed page. Different page replacement
algorithms suggest different ways to decide which page to replace. The target for
all algorithms is to reduce the number of page faults.
Initially all slots are empty, so when 1, 3, 0 came they are allocated to the
empty slots —> 3 Page Faults.
when 3 comes, it is already in memory so —> 0 Page Faults.
Then 5 comes, it is not available in memory so it replaces the oldest page
slot i.e 1. —>1 Page Fault.
6 comes, it is also not available in memory so it replaces the oldest page
slot i.e 3 —>1 Page Fault.
Finally when 3 come it is not avilable so it replaces 0 1 page fault
Belady’s anomaly – Belady’s anomaly proves that it is possible to have more page
faults when increasing the number of page frames while using the First in First
Out (FIFO) page replacement algorithm. For example, if we consider reference
string 3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4 and 3 slots, we get 9 total page faults, but if we
increase slots to 4, we get 10 page faults.
Initially all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4
Page faults
0 is already there so —> 0 Page fault.
when 3 came it will take the place of 7 because it is not used for the longest
duration of time in the future.—>1 Page fault.
0 is already there so —> 0 Page fault..
4 will takes place of 1 —> 1 Page Fault.
Now for the further page reference string —> 0 Page fault because they are
already available in the memory.
Optimal page replacement is perfect, but not possible in practice as the operating
system cannot know future requests. The use of Optimal Page replacement is to
set up a benchmark so that other replacement algorithms can be analyzed against
it.
Initially all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4
Page faults
0 is already their so —> 0 Page fault.
when 3 came it will take the place of 7 because it is least recently used —>1 Page
fault
0 is already in memory so —> 0 Page fault.
4 will takes place of 1 —> 1 Page Fault
Now for the further page reference string —> 0 Page fault because they are
already available in the memory.
Storage Management
Storage management can also help improve a data center's performance. For
example, compression and technology can enable faster I/Os, and automatic
storage provisioning can speed the process of assigning storage resources to
various applications.
Mass storage
Mass storage refers to various techniques and devices for storing large amounts
of data. The earliest storage devices were punched paper cards, which were used
as early as 1804 to control silk-weaving looms. Modern mass storage devices
include all types of disk drives and tape drives.
Mass storage is distinct from memory, which refers to temporary storage areas
within the computer. Unlike main memory, mass storage devices retain data even
when the computer is turned off.
hard drives
optical drives
tape drives
RAID storage
USB storage
RAID
Originally, the term RAID was defined as redundant array of inexpensive disks, but
now it usually refers to a redundant array of independent disks. RAID storage uses
multiple disks in order to provide fault tolerance, to improve overall performance,
and to increase storage capacity in a system. This is in contrast with older storage
devices that used only a single disk drive to store data.
RAID allows you to store the same data redundantly (in multiple paces) in a
balanced way to improve overall performance. RAID disk drives are used
frequently on servers but aren't generally necessary for personal computers.
With RAID technology, data can be mirrored on one or more disks in the same
array, so that if one disk fails, the data is preserved. Thanks to a technique known
as striping (a technique for spreading data over multiple disk drives), RAID also
offers the option of reading or writing to more than one disk at the same time in
order to improve performance.
In this arrangement, sequential data is broken into segments which are sent to
the various disks in the array, speeding up throughput. A typical RAID array uses
multiple disks that appear to be a single device so it can provide more storage
capacity than a single disk.
RAID devices use many different architectures, called levels, depending on the
desired balance between performance and fault tolerance. RAID levels describe
how data is distributed across the drives. Standard RAID levels include the
following:
Provides data striping (spreading out blocks of each file across multiple disk
drives) but no redundancy. This improves performance but does not deliver fault
tolerance. If one drive fails then all data in the array is lost.
Provides disk mirroring. Level 1 provides twice the read transaction rate of single
disks and the same write transaction rate as single disks.
Not a typical implementation and rarely used, Level 2 stripes data at the bit level
rather than the block level.
Provides byte-level striping with a dedicated parity disk. Level 3, which cannot
service simultaneous multiple requests, also is rarely used.
Provides data striping at the byte level and also stripe error correction
information. This results in excellent performance and good fault tolerance. Level
5 is one of the most popular implementations of RAID.
Provides block-level striping with parity data distributed across all disks.
Not one of the original RAID levels, multiple RAID 1 mirrors are created, and a
RAID 0 stripe is created over these.
Some devices use more than one level in a hybrid or nested arrangement, and
some vendors also offer non-standard proprietary RAID levels. Examples of non-
standard RAID levels include the following:
Not one of the original RAID levels, two RAID 0 stripes are created, and a RAID 1
mirror is created over them. Used for both replicating and sharing data among
disks.
Level 7
RAID 1E
A RAID 1 implementation with more than two disks. Data striping is combined
with mirroring each written stripe to one of the remaining disks in the array.
RAID S
Also called Parity RAID, this is EMC Corporation's proprietary striped parity RAID
system used in its Symmetrix storage systems.
Before RAID devices became popular, most systems used a single drive to store
data. This arrangement is sometimes referred to as a SLED (single large expensive
disk). However, SLEDs have some drawbacks. First, they can create
I/O bottlenecks because the data cannot be read from the disk quickly enough to
keep up with the other components in a system, particularly the processor.
Second, if a SLED fails, all the data is lost unless it has been recently backed up
onto another disk or tape.
RAID should not be confused with data backup. Although some RAID levels do
provide redundancy, experts advise utilizing a separate storage system for backup
and disaster recovery purposes.
In order to set up a RAID array, you'll need a group of disk drives and either a
software or a hardware controller. Software RAID runs directly on a server,
utilizing server resources. As a result, it may cause some applications to run more
slowly. Most server operating systems include some built-in RAID management
capabilities.
You can also set up your own RAID array by adding a RAID controller to a server or
a desktop PC. The RAID controller runs essentially the same software, but it uses
its own processor instead of the system's CPU. Some less expensive "fake RAID"
controllers provide RAID management software but don't have a separate
processor.
Alternatively, you can purchase a pre-built RAID array from a storage vendor.
These appliances generally include two RAID controllers and a group of disks in
their own housing.
Using a RAID array is usually no different than using any other kind of primary
storage. The RAID management will be handled by the hardware or software
controller and is generally invisible to the end user.
The Storage Networking Industry Association has established the Common RAID
Disk Data Format (DDF) specification. In an effort to promote interoperability
among different RAID vendors, it defines how data should be distributed across
the disks in a RAID device.
Another industry group called the RAID Advisory Board worked during the 1990s
to promote RAID technology, but the group is no longer active.
Disk Structure
Secondary Storage
Secondary storage devices are those devices whose memory is non volatile,
meaning, the stored data will be intact even if the system is turned off. Here are a
few things worth noting about secondary storage.
The speed of the secondary storage is also lesser than that of primary
storage.
Hence, the data which is less frequently accessed is kept in the secondary
storage.
A magnetic disk contains several platters. Each platter is divided into circular
shaped tracks. The length of the tracks near the centre is less than the length of
the tracks farther from the centre. Each track is further divided into sectors, as
shown in the figure.
Tracks of the same distance from centre form a cylinder. A read-write head is
used to read data from a sector of the magnetic disk.
Transfer rate: This is the rate at which the data moves from disk to the
computer.
Random access time: It is the sum of the seek time and rotational latency.
Seek time is the time taken by the arm to move to the required track. Rotational
latency is defined as the time taken by the arm to reach the required sector in the
track.
Even though the disk is arranged as sectors and tracks physically, the data is
logically arranged and addressed as an array of blocks of fixed size. The size of a
block can be 512 or 1024 bytes. Each logical block is mapped with a sector on the
disk, sequentially. In this way, each sector in the disk will have a logical address.
The three main jobs of a computer are Input, Output, and Processing. In most of
the cases, the most important job is Input / Output, and the processing is simply
incidental. For an example, when we browse a web page or edit any file, our
immediate attention is to read or enter some information, not for computing an
answer. The fundamental role of the operating system in computer Input /
Output is to manage and organize I/O operations and all I/O devices.
The various devices that are connected to the computer need to be controlled
and it is a key concern of operating-system designers. This is as I/O devices vary so
widely in their functionality and speed (for example a mouse, a hard disk and a
CD-ROM), varied methods are required for controlling them. These methods form
the I/O sub-system of the kernel of OS that separates the rest of the kernel from
the complications of managing I/O devices.
When a file is used, information is read and accessed into computer memory and
there are several ways to access this information of the file. Some systems
provide only one access method for files. Other systems, such as those of IBM,
support many access methods, and choosing the right one for a particular
application is a major design problem.
There are three ways to access a file into a computer system: Sequential-Access,
Direct Access, Index sequential Method.
1. Sequential Access –
It is the simplest access method. Information in the file is processed in
order, one record after the other. This mode of access is by far the most
common; for example, editor and compiler usually access the file in this
fashion.
Read and write make up the bulk of the operation on a file. A read operation -
read next- read the next position of the file and automatically advance a file
pointer, which keeps track I/O location. Similarly, for the writewrite next append
to the end of the file and advance to the newly written material.
Key points:
1.
When we use write command, it will allocate memory and move the
pointer to the end of the file
2. Direct Access –
Another method is direct access method also known as relative access
method. A filed-length logical record that allows the program to read and
write record rapidly. in no particular order. The direct access is based on
the disk model of a file since disk allows random access to any file block.
For direct access, the file is viewed as a numbered sequence of block or
record. Thus, we may read block 14 then block 59 and then we can write
block 17. There is no restriction on the order of reading and writing for a
direct access file.
Key points:
Structures of Directory
A directory is a container that is used to contain folders and file. It organizes files
and folders into a hierarchical manner.
There are several logical structures of a directory, these are given below.
1. Single-level directory –
Single level directory is simplest directory structure.In it all files are
contained in same directory which make it easy to support and understand.
A single level directory has a significant limitation, however, when the number of
files increases or when the system has more than one user. Since all the files are
in the same directory, they must have the unique name . if two users call their
dataset test, then the unique name rule violated.
Advantages:
Disadvantages:
There may chance of name collision because two files can not have
the same name.
2. Two-level directory –
As we have seen, a single level directory often leads to confusion of files
names among different users. the solution to this problem is to create a
separate directory for each user.
In the two-level directory structure, each user has there own user files directory
(UFD). The UFDs has similar structures, but each lists only the files of a single user.
system’s master file directory (MFD) is searches whenever a new user id=s logged
in. The MFD is indexed by username or account number, and each entry points to
the UFD for that user.
Advantages:
Searching of files become more easy due to path name and user-
grouping.
Disadvantages:
1.
Still it not very scalable, two files of the same type cannot be grouped
together in the same user.
2. Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2, the natural
generalization is to extend the directory structure to a tree of arbitrary
height.
This generalization allows the user to create there own subdirectories and
to organize on their files accordingly.
A tree structure is the most common directory structure. The tree has a root
directory, and every file in the system have a unique path.
Advantages:
Searching becomes very easy, we can use both absolute path as well
as relative.
Disadvantages:
Every file does not fit into the hierarchical model, files may be saved
into multiple directories.
It is used in the situation like when two programmers are working on a joint
project and they need to access files. The associated files are stored in a
subdirectory, separating them from other projects and files of other
programmers, since they are working on a joint project so they want the
subdirectories to be into their own directories. The common subdirectories
should be shared. So here we use Acyclic directories.
It is the point to note that shared file is not the same as copy file . If any
programmer makes some changes in the subdirectory it will reflect in both
subdirectories.
Advantages:
Disadvantages:
We share the files via linking, in case of deleting it may create the
problem,
If the link is softlink then after deleting the file we left with a dangling
pointer.
The main problem with this kind of directory structure is to calculate total
size or space that has been taken by the files and directories.
Advantages:
It allows cycles.
Disadvantages:
There are various on disk data structures that are used to implement a file
system. This structure may vary depending upon the operating system.
Boot Control Block contains all the information which is needed to boot an
operating system from that volume. It is called boot block in UNIX file system. In
NTFS, it is called the partition boot sector.
154 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
Volume control block all the information regarding that volume such as number
of blocks, size of each block, partition table, pointers to free blocks and free FCB
blocks. In UNIX file system, it is known as super block. In NTFS, this information is
stored inside master file table.
A directory structure (per file system) contains file names and pointers to
corresponding FCBs. In UNIX, it includes inode numbers associated to file names.
File Control block contains all the details about the file such as ownership details,
permission details, file size,etc. In UFS, this detail is stored in inode. In NTFS, this
information is stored inside master file table as a relational database structure. A
typical file control block is shown in the image below.
Each filesystem has its own root directory . The filesystem whose root directory is
the root of the system’s directory tree is called root filesystem . Other filesystems
can be mounted on the system’s directory tree; the directories on which they are
inserted are called mount points . A mounted filesystem is the child of the
mounted filesystem to which the mount point directory belongs. For instance,
the /proc virtual filesystem is a child of the root filesystem (and the root
filesystem is the parent of /proc).
In most traditional Unix-like kernels, each filesystem can be mounted only once.
Suppose that an Ext2 filesystem stored in the /dev/fd0 floppy disk is mounted
on /flp by issuing the command:
However, Linux 2.4 is different: it is possible to mount the same filesystem several
times. For instance, issuing the following command right after the previous one
will likely succeed in Linux:
As a result, the Ext2 filesystem stored in the floppy disk is mounted both
on /flp and on /flp-ro; therefore, its files can be accessed through
both /flp and /flp-ro (in this example, accesses through /flp-ro are read-only).
File Sharing
File sharing can be done using several methods. The most common techniques for
file storage, distribution and transmission include the following:
Operating systems also provide file-sharing methods, such as network file sharing
(NFS). Most file-sharing tasks use two basic sets of network criteria, as follows:
Peer-to-Peer (P2P) File Sharing: This is the most popular, but controversial,
method of file sharing because of the use of peer-to-peer software.
Network computer users locate shared data with third-party software. P2P
file sharing allows users to directly access, download and edit files. Some
third-party software facilitates P2P sharing by collecting and segmenting
large files into smaller pieces.
Once users download or make use of a file using a file-sharing network, their
computer also becomes a part of that network, allowing other users to download
files from the user's computer. File sharing is generally illegal, with the exception
of sharing material that is not copyrighted or proprietary. Another issue with file-
sharing applications is the problem of spyware or adware, as some file-sharing
websites have placed spyware programs in their websites. These spyware
programs are often installed on users' computers without their consent and
awareness.
File Systems
File system is the part of the operating system which is responsible for file
management. It provides a mechanism to store the data and access to the file
contents including data and programs. Some Operating systems treats everything
as a file for example Ubuntu.
o File Structure
We have seen various data structures in which the file can be stored. The task of
the file system is to maintain an optimal file structure.
Whenever a file gets deleted from the hard disk, there is a free space created in
the disk. There can be many such spaces which need to be recovered in order to
reallocate them to other files.
The major concern about the file is deciding where to store the files on the hard
disk. There are various disks scheduling algorithm which will be covered later in
this tutorial.
A File may or may not be stored within only one block. It can be stored in the non
contiguous blocks on the disk. We need to keep track of all the blocks on which
the part of the files reside.
File System provide efficient access to the disk by allowing data to be stored,
located and retrieved in a convenient way. A file System must be able to store the
file, locate the file and retrieve the file.
Most of the Operating Systems use layering approach for every task including file
systems. Every layer of the file system is responsible for some activities.
The image shown below, elaborates how the file system is divided in different
layers, and also the functionality of each layer.
When an application program asks for a file, the first request is directed
to the logical file system. The logical file system contains the Meta data
of the file and directory structure. If the application program doesn't
have the required permissions of the file then this layer will throw an
error. Logical file systems also verify the path to the file.
Generally, files are divided into various logical blocks. Files are to be
stored in the hard disk and to be retrieved from the hard disk. Hard disk
is divided into various tracks and sectors. Therefore, in order to store
and retrieve the files, the logical blocks need to be mapped to physical
blocks. This mapping is done by File organization module. It is also
responsible for free space management.
Once File organization module decided which physical block the
application program needs, it passes this information to basic file
system. The basic file system is responsible for issuing the commands to
I/O control in order to fetch those blocks.
I/O controls contain the codes by using which it can access hard disk.
These codes are known as device drivers. I/O controls are also
responsible for handling interrupts.
Advantages :
2. Each file system can have its own logical file system.
Disadvantages :
If we access many files at same time then it results in low performance.
1. On-disk Structures –
Generally they contain information about total number of disk blocks, free disk
blocks, location of them and etc. Below given are different on-disk structures :
3. Directory Structure –
They store file names and associated inode numbers.In UNIX,
includes file names and associated file names and in NTFS, it is stored
in master file table.
4. Per-File FCB –
It contains details about files and it has a unique identifier number to
allow association with directory entry. In NTFS it is stored in master
file table.
2. In-Memory Structure :
They are maintained in main-memory and these are helpful for file system
management for caching. Several in-memory structures given below :
5. Mount Table –
It contains information about each mounted volume.
6. Directory-Structure cache –
This cache holds the directory information of recently accessed
directories.
Directory Implementation :
9. Linear List –
It maintains a linear list of filenames with pointers to the data
blocks.It is time-consuming also.To create a new file, we must first
search the directory to be sure that no existing file has the same
name then we add a file at end of the directory.To delete a file, we
search the directory for the named file and release the space.To
reuse the directory entry either we can mark the entry as unused or
we can attach it to a list of free directories.
Directory Implementation
1. Linear List
In this algorithm, all the files in a directory are maintained as singly lined list. Each
file contains the pointers to the data blocks which are assigned to it and the next
file in the directory.
Characteristics
1. When a new file is created, then the entire list is checked whether the new
file name is matching to a existing file name or not. In case, it doesn't exist,
the file can be created at the beginning or at the end. Therefore, searching
for a unique name is a big concern because traversing the whole list takes
time.
2. Hash Table
A key-value pair for each file in the directory gets generated and stored in the
hash table. The key can be determined by applying the hash function on the file
name while the key points to the corresponding file stored in the directory.
Now, searching becomes efficient due to the fact that now, entire list will not be
searched on every operating. Only hash table entries are checked using the key
and if an entry found then the corresponding file will be fetched using the value.
Allocation Methods
There are various methods which can be used to allocate disk space to the files.
Selection of an appropriate allocation method will significantly affect the
performance and efficiency of the system. Allocation method provides a way in
which the disk will be utilized and the files will be accessed.
1. Contiguous Allocation.
2. Extents
3. Linked Allocation
4. Clustering
5. FAT
6. Indexed Allocation
9. Inode
A file system is responsible to allocate the free blocks to the file therefore it has
to keep track of all the free blocks present in the disk. There are mainly two
approaches by using which, the free blocks in the disk are managed.
1. Bit Vector
In this approach, the free space list is implemented as a bit map vector. It contains
the number of bits where each bit represents each block.
If the block is empty then the bit is 1 otherwise it is 0. Initially all the blocks are
empty therefore each bit in the bit map vector contains 1.
LAs the space allocation proceeds, the file system starts allocating blocks to the
files and setting the respective bit to 0.
2. Linked List
It is another approach for free space management. This approach suggests linking
together all the free blocks and keeping a pointer in the cache which points to the
first free block.
Therefore, all the free blocks on the disks will be linked together with a pointer.
Whenever a block gets allocated, its previous free block will be linked to its next
free block.
Efficiency
The efficient use of disk space depends heavily on the disk allocation and
directory algorithms in use. For instance, UNIX inodes are preallocated on a
volume. Even an "empty" disk has a percentage of its space lost to inodes.
However, by preallocating the inodes and. spreading them across the volume, we
improve the file system's performance. This improved performance results from
the UNIX allocation and free-space algorithms, which try to keep a file's data
blocks near that file's inode block to reduce seek time. As another example, let's
reconsider the clustering scheme discussed in Section 11.4, which aids in file-seek
and file-transfer performance at the cost of internal fragmentation.
To reduce this fragmentation, BSD UNIX varies the cluster size as a file grows.
Large clusters are used where they can be filled, and small clusters are used for
small files and the last cluster of a file. This system is described in Appendix A. The
types of data normally kept in a file's directory (or inode) entry also require
consideration. Commonly, a 'last write date" is recorded to supply information to
the user and, to determine whether the file needs to be backed up. Some systems
also keep a "last access date," so that a user can determine when the file was last
read.
The result of keeping this information is that, whenever the file is read, a field in
the directory structure must be written to. That means the block must be read
into memory, a section changed, and the block written back out to disk, because
operations on disks occur only in block (or cluster) chunks. So any time a file is
opened for reading, its directory entry must be read and written as well. This
requirement can be inefficient for frequently accessed files, so we must weigh its
benefit against its performance cost when designing a file system. Generally,
every data item associated with a file needs to be considered for its effect on
efficiency and performance.
As disk capacities increased, larger disks had to be split into 32-MB partitions,
because the file system could not track blocks beyond 32 MB. As hard disks with
capacities of over 100 MB became common, most disk controllers include local
memory to form an on-board cache that is large enough to store entire tracks at a
time. Once a seek is performed, the track is read into the disk cache starting at
the sector under the disk head (reducing latency time).
The disk controller then transfers any sector requests to the operating system.
Once blocks make it from the disk controller into main memory, the operating
system may cache the blocks there. Some systems maintain a separate section of
main memory for a buffer cache, where blocks are kept under the assumption
that they will be used again shortly. Other systems cache file data using a page
cache.
The page cache uses virtual memory techniques to cache file data as pages rather
than as file-system-oriented blocks. Caching file data using virtual addresses is far
more efficient than caching through physical disk blocks, as accesses interface
with virtual memory rather than the file system. Several systems—including
Solaris, Linux, and Windows NT, 2000, and XP—use page caching to cache both
process pages and file data. This is known as unified virtual memory. Some
versions of UNIX and Linux provide a unified buffer cache. To illustrate the
benefits of the unified buffer cache, consider the two alternatives for opening and
accessing a file. One approach is to use memory mapping (Section 9.7); the
second is to use the standard system calls readO and write 0 . Without a unified
buffer cache, we have a situation similar to Figure 11.11.
Here, the read() and write () system calls go through the buffer cache. The
memory-mapping call, however, requires using two caches—the page cache and
the buffer cache. A memory mapping proceeds by reading in disk blocks from the
file system and storing them in the buffer cache. Because the virtual memory
system does not interface with the buffer cache, the contents of the file in the
buffer cache must be copied into the page cache. This situation is known as
double caching and requires caching file-system data twice. Not only does it
waste memory but it also wastes significant CPU and I/O cycles due to the extra
data movement within, system memory.
In add ition, inconsistencies between the two caches can result in corrupt files. In
contrast, when a unifiedthe disk data structures and algorithms in MS-DOS had to
be modified to allow larger file systems. (Each FAT entry was expanded to 16 bits
and later to 32 bits.) The initial file-system decisions were made for efficiency
reasons; however, with the advent of MS-DOS version 4, millions of computer
users were inconvenienced when they had to switch to the new, larger file
system. Sun's ZFS file system uses 128-bit pointers, which theoretically should
never need to be extended. (The minimum mass of a device capable of storing
2'2S bytes using atomic-level storage would be about 272 trillion kilograms.) As
another example, consider the evolution of Sun's Solaris operating system.
Originally, many data structures were of fixed length, allocated at system startup.
These structures included the process table and the open-file table. When the
process table became full, no more processes could be created. When the file
table became full, no more files could be opened. The system would fail to
provide services to users. Table sizes could be increased only by recompiling the
kernel and rebooting the system. Since the release of Solaris 2, almost all kernel
structures have been allocated dynamically, eliminating these artificial limits on
system performance. Of course, the algorithms that manipulate these tables are
more complicated, and the operating system is a little slower because it must
dynamically allocate and deallocate table entries; but that price is the usual one
for more general, functionality.
Performance
Even after the basic file-system algorithms have been selected, we can still
improve performance in several ways. As will be discussed in Chapter 13, most
disk controllers include local memory to form an on-board cache that is large
enough to store entire tracks at a time. Once a seek is performed, the track is
read into the disk cache starting at the sector under the disk head (reducing
latency time). The disk controller then transfers any sector requests to the
operating system. Once blocks make it from the disk controller into main
memory, the operating system may cache the blocks there. Some systems
maintain a separate section of main memory for a buffer cache, where blocks are
kept under the assumption that they will be used again shortly. Other systems
cache file data using a page cache.
The page cache uses virtual memory techniques to cache file data as pages rather
than as file-system-oriented blocks. Caching file data using virtual addresses is far
more efficient than caching through physical disk blocks, as accesses interface
with virtual memory rather than the file system. Several systems—including
Solaris, Linux, and Windows NT, 2000, and XP—use page caching to cache both
process pages and file data. This is known as unified virtual memory. Some
versions of UNIX and Linux provide a unified buffer cache.
To illustrate the benefits of the unified buffer cache, consider the two alternatives
for opening and accessing a file. One approach is to use memory mapping
(Section 9.7); the second is to use the standard system calls readO and write 0 .
Without a unified buffer cache, we have a situation similar to Figure 11.11. Here,
the read() and write () system calls go through the buffer cache. The memory-
mapping call, however, requires using two caches—the page cache and the buffer
cache. A memory mapping proceeds by reading in disk blocks from the file system
and storing them in the buffer cache. Because the virtual memory system does
not interface with the buffer cache, the contents of the file in the buffer cache
must be copied into the page cache.
This situation is known as double caching and requires caching file-system data
twice. Not only does it waste memory but it also wastes significant CPU and I/O
cycles due to the extra data movement within, system memory. In add ition,
inconsistencies between the two caches can result in corrupt files. In contrast,
when a unified buffer cache is provided, both memory mapping and the read ()
and write () system calls use the same page cache. This has the benefit of avoiding
double caching, and it allows the virtual memory system to manage file-system
data. The unified buffer cache is shown in Figure 11.12. Regardless of whether we
are caching disk blocks or pages (or both), LEU (Section 9.4.4) seems a reasonable
general-purpose algorithm for block or page replacement. However, the evolution
of the Solaris page-caching algorithms reveals the difficulty in choosing an
algorithm. Solaris allows processes and the page cache to share unused inemory.
Versions earlier than Solaris 2.5.1 made no distinction between allocating pages
to a process and allocating them to the page cache. As a result, a system
performing many I/O operations used most of the available memory for caching
pages. Because of the high rates of I/O, the page scanner (Section 9.10.2)
reclaimed pages from processes— rather than from the page cache—when free
memory ran low. Solaris 2.6 and Solaris 7 optionally implemented priority paging,
in which the page scanner gives priority to process pages over the page cache.
Solaris 8 applied a fixed limit to process pages and the file-system page cache,
preventing either from forcing the other out of memory. Solaris 9 and 10 again
changed the algorithms to maximize memory use and minimize thrashing. This
real-world example shows the complexities of performance optimizing and
caching.
There are other issvies that can affect the performance of I/O such as whether
writes to the file system occur synchronously or asynchronously. Synchronous
writes occur in the order in which the disk subsystem receives them, and the
writes are not buffered. Thus, the calling routine must wait for the data to reach
the disk drive before it can proceed. Asynchronous writes are done the majority
of the time. In an asynchronous write, the data are stored in the cache, and
control returns to the caller. Metadata writes, among others, can be synchronous.
Operating systems frequently include a flag in the open system call to allow a
process to request that writes be performed synchronously. For example,
databases use this feature for atomic transactions, to assure that data reach
stable storage in the required order. Some systems optimize their page cache by
using different replacement algorithms, depending on the access type of the file.
A file being read or written sequentially should not have its pages replaced in LRU
order, because the most 11.7 Recovery 435 recently used page will be used last,
or perhaps never again. Instead, sequential access can be optimized by
techniques known as free-behind and read-ahead. Free-behind removes a page
from the buffer as soon as the next page is requested. The previous pages are not
likely to be used again and waste buffer space. With read-ahead, a requested
page and several subsequent pages are read and cached. These pages are likely to
be requested after the current page is processed.
Retrieving these data from the disk in one transfer and caching them saves a
considerable amount of time. One might think a track cache on the controller
eliminates the need for read-ahead on a multiprogrammed system. However,
because of the high latency and overhead involved in making many small
transfers from the track cache to main memory, performing a read-ahead remains
beneficial. The page cache, the file system, and the disk drivers have some
interesting interactions. When data are written to a disk file, the pages are
buffered in the cache, and the disk driver sorts its output queue according to disk
address. These two actions allow the disk driver to minimize disk-head seeks and
to write data at times optimized for disk rotation.
Unless synchronous writes are required, a process writing to disk simply writes
into the cache, and the system asynchronously writes the data to disk when
convenient. The user process sees very fast writes. When data are read from a
disk file, the block I/O system does some read-ahead; however, writes are much
more nearly asynchronous than are reads. Thus, output to the disk through the
file system is often faster than is input for large transfers, counter to intuition.
File System-Recovery
Recovery
Files and directories are kept both in main memory and on disk, and care must
taken to ensure that system failure does not result in loss of data or in data
inconsistency. We deal with these issues in the following sections.
Consistency Checking
Magnetic disks sometimes fail, and care must be taken to ensure that the data
lost in such a failure are not lost forever. To this end, system programs can be
used to back up data from disk to another storage device, such as a floppy disk,
magnetic tape, optical disk, or other hard disk.
Recovery from the loss of an individual file, or of an entire disk, may then be a
matter of restoring the data from backup. To minimize the copying needed, we
can use information from each file's directory entry. For instance, if the backup
program knows when the last backup of a file was done, and the file's last write
date in the directory indicates that the file has not changed since that date, then
the file does not need to be copied again. A typical backup schedule may then be
as follows:
• Day 1. Copy to a backup medium all files from the disk. This is called a full
backup.
• Day 2. Copy to another medium all files changed since day 1. This is an
incremental backup.
• Day N. Copy to another medium all files changed since day N— 1. Then go back
to Day 1. The new cycle can have its backup written over the previous set or onto
a new set of backup media.
In this manner, we can restore an entire disk by starting restores with the full
backup and continuing through each of the incremental backups. Of course, the
larger the value of N, the greater the number of tapes or disks that must be read
for a complete restore. An added advantage of this backup cycle is that we can
restore any file accidentally deleted during the cycle by retrieving the deleted file
from the backup of the previous day.
The length of the cycle is a compromise between the amount of backup medium
needed and the number of days back from which a restore can be done. To
decrease the number of tapes that must be read, to do a restore, an option is to
perform a full backup and then each day back up all files that have changed since
the full backup. In this way, a restore can be done via the most recent incremental
backup and. the full backup, with no other incremental backups needed. The
trade-off is that more files will be modified each day, so each successive
incremental backup involves more files and more backup media.
A user may notice that a particular file is missing or corrupted long after the
damage was done. For this reason, we usually plan to take a full backup from time
to time that will be saved "forever." It is a good idea to store these permanent
backups far away from the regular backups to protect against hazard, such as a
fire that destroys the computer and all the backups too. And if the backup cycle
reuses media, we must take care not to reuse the media too many times—if the
media wear out, it might not be possible to restore any data from the backups.
I/O Hardware
An I/O system is required to take an application I/O request and send it to the
physical device, then take whatever response comes back from the device and
send it to the application. I/O devices can be divided into two categories −
Block devices − A block device is one with which the driver communicates
by sending entire blocks of data. For example, Hard disks, USB cameras,
Disk-On-Key etc.
Device Controllers
Device drivers are software modules that can be plugged into an OS to handle a
particular device. Operating System takes help from device drivers to handle all
I/O devices.
The Device Controller works like an interface between a device and a device
driver. I/O units (Keyboard, mouse, printer, etc.) typically consist of a mechanical
component and an electronic component where electronic component is called
the device controller.
There is always a device controller and a device driver for each device to
communicate with the Operating Systems. A device controller may be able to
handle multiple devices. As an interface its main task is to convert serial bit
stream to block of bytes, perform error correction as necessary.
Any device connected to the computer is connected by a plug and socket, and the
socket is connected to a device controller. Following is a model for connecting the
CPU, memory, controllers, and I/O devices where CPU and device controllers all
use a common bus for communication.
Synchronous I/O − In this scheme CPU execution waits while I/O proceeds
The CPU must have a way to pass information to and from an I/O device. There
are three approaches available to communicate with the CPU and Device.
Memory-mapped I/O
This uses CPU instructions that are specifically made for controlling I/O devices.
These instructions typically allow data to be sent to an I/O device or read from an
I/O device.
Memory-mapped I/O
When using memory-mapped I/O, the same address space is shared by memory
and I/O devices. The device is connected directly to certain main memory
locations so that I/O device can transfer block of data to/from memory without
going through CPU.
While using memory mapped IO, OS allocates buffer in memory and informs I/O
device to use that buffer to send data to the CPU. I/O device operates
asynchronously with CPU, interrupts CPU when finished.
The advantage to this method is that every instruction which can access memory
can be used to manipulate an I/O device. Memory mapped IO is used for most
high-speed I/O devices like disks, communication interfaces.
Slow devices like keyboards will generate an interrupt to the main CPU after each
byte is transferred. If a fast device such as a disk generated an interrupt for each
byte, the operating system would spend most of its time handling these
interrupts. So a typical computer uses direct memory access (DMA) hardware to
reduce this overhead.
Direct Memory Access (DMA) means CPU grants I/O module authority to read
from or write to memory without involvement. DMA module itself controls
exchange of data between main memory and the I/O device. CPU is only involved
at the beginning and end of the transfer and interrupted only after entire block
has been transferred.
Direct Memory Access needs a special hardware called DMA controller (DMAC)
that manages the data transfers and arbitrates access to the system bus. The
controllers are programmed with source and destination pointers (where to
read/write the data), counters to track the number of transferred bytes, and
settings, which includes I/O and memory types, interrupts and states for the CPU
cycles.
Step Description
A computer must have a way of detecting the arrival of any type of input. There
are two ways that this can happen, known as polling and interrupts. Both of these
techniques allow the processor to deal with events that can happen at any time
and that are not related to the process it is currently running.
Polling I/O
Polling is the simplest way for an I/O device to communicate with the processor.
The process of periodically checking status of the device to see if it is time for the
next I/O operation, is called polling. The I/O device simply puts the information in
a Status register, and the processor must come and get the information.
Most of the time, devices will not require attention and when one does it will
have to wait until it is next interrogated by the polling program. This is an
inefficient method and much of the processors time is wasted on unnecessary
polls.
180 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
Compare this method to a teacher continually asking every student in a class, one
after another, if they need help. Obviously the more efficient method would be
for a student to inform the teacher whenever they require assistance.
Interrupts I/O
A device controller puts an interrupt signal on the bus when it needs CPU’s
attention when CPU receives an interrupt, It saves its current state and invokes
the appropriate interrupt handler using the interrupt vector (addresses of OS
routines to handle various events). When the interrupting device has been dealt
with, the CPU continues with its original task as if it had never been interrupted.
In this section, we discuss structuring techniques and interfaces for the operating
system that enable I/O devices to be treated in a standard, uniform way. We
explain, for instance, how an application can open a file on a disk without
knowing what kind of disk it is and how new disks and other devices can be added
to a computer without disruption of the operating system. Like other complex
software-engineering problems, the approach here involves abstraction,
encapsulation, and software layering. Specifically we can abstract away the
detailed differences in I/O devices by identifying a fewgeneral kinds. Each general
kind is accessed through a standardized set of functions—an interface. The
differences are encapsulated in kernel modules called device drivers that
internally are custom-tailored to each device but that export one of the standard
interfaces.
Figure 13.6 illustrates how the I/O-related portions of the kernel are structured in
software layers. The purpose of the device-driver layer is to hide the differences
among device controllers from the I/O subsystem of the kernel, much as the I/O
system calls encapsulate the behavior of devices in a few generic classes that hide
hardware differences from applications. Making the I/O subsystem independent
of the hardware simplifies the job of the operating-system developer. It also
benefits the hardware manufacturers. They either design new devices to be
compatible with an existing host controller interface (such as SCSI-2), or they
write device drivers to interface the new hardware to popular operating systems.
Thus, we can attach new peripherals to a computer without waiting for the
operating-system vendor to develop support code. Unfortunately for device-
hardware manufacturers, each type of operating system has its own standards for
the device-driver interface. A given device may ship with multiple device drivers—
for instance, drivers for MS-DOS, Windows 95/98, Windows NT/2000, and Solaris.
Devices vary on many dimensions, as illustrated in Figure 13.7.
• Read-write, read only, or write only. Some devices perform both input and
output, but others support only one data direction. For the purpose of application
access, many of these differences are hidden by the operating system, and the
devices are grouped into a few conventional types. The resulting styles of device
access have been found to be useful and broadly applicable. Although the exact
system calls may differ across operating systems, the device categories are fairly
standard. The major access conventions include block I/O, character-stream I/O,
memory-mapped file access, and network sockets. Operating systems also
provide special system calls to access a few additional devices, such as a time-of-
day clock and a timer. Some operating systems provide a set of system calls for
graphical display, video, and audio devices. Most operating systems also have an
escape (or back door) that transparently passes arbitrary commands from an
application to a device driver. In UNIX, this system call is ioctl O (for "I/O" control).
The ioctl O system call enables an application to access any functionality that can
be implemented by any device driver, without the need to invent a new system
call. The ioctl O system call has three arguments.
The first is a file descriptor that connects the application to the driver by referring
to a hardware device managed by that driver. The second is an integer that
selects one of the commands implemented in the driver. The third is a pointer to
an arbitrary data structure in memory that enables the application and driver to
communicate any necessary control information or data.
The block-device interface captures all the aspects necessary for accessing disk
drives and other block-oriented devices. The device is expected to understand
commands such as read () and wr it e (); if it is a random-access device, it is also
expected to have a seek() command to specify which block to transfer next.
Applications normally access such a device through a file-system interface. We
can see that readO, write (), and seekO capture the essential behaviors of block-
storage devices, so that applications are insulated from the low-level differences
among those devices.
To avoid these conflicts, raw-device access passes control of the device directly to
the application, letting the operating system step out of the way. Unfortunately,
no operating-system services are then performed on this device. A compromise
that is becoming common is for the operating system to allow a mode of
operation on a file that disables buffering and locking.
In the UNIX world, this is called direct I/O. Memory-mapped file access can be
layered on top of block-device drivers. Rather than offering read and write
operations, a memory-mapped interface provides access to disk storage via an
array of bytes in main memory. The system call that maps a file into memory
returns the virtual memory address that contains a copy of the file. The actual
data transfers are performed only when needed to satisfy access to the memory
image. Because the transfers are handled by the same mechanism as that used
for demand-paged virtual memory access, memory-mapped I/O is efficient.
Memory mapping is also convenient for programmers—access to a memory-
mapped file is as simple as reading from and writing to memory. Operating
systems that offer virtual memory commonly use the mapping interface for kernel
services. For instance, to execute a program, the operating system maps the
executable into memory and then transfers control to the entry address of the
executable.
The mapping interface is also commonly used for kernel access to swap space on
disk. A keyboard is an example of a device that is accessed through a
characterstream interface. The basic system calls in this interface enable an
application to get() or putO one character. On top of this interface, libraries can
be built that offer line-at-a-time access, with buffering and editing services (for
example, when a user types a backspace, the preceding character is removed
from the input stream). This style of access is convenient for input devices such as
keyboards, mice, and modems that produce data for input "spontaneously" —
that is, at times that cannot necessarily be predicted by the application. This
access style is also good for output devices such as printers and audio boards,
which naturally fit the concept of a linear stream of bytes.
Network Devices
Most computers have hardware clocks and timers that provide three basic
functions:
Set a timer to trigger operation X at time T. These functions are used heavily by
the operating system, as well as by timesensitive applications. Unfortunately, the
system calls that implement these functions are not standardized across
operating systems. The hardware to measure elapsed time and to trigger
operations is called a programmable interval timer. It can be set to wait a certain
amount of time and then generate an interrupt, and it can be set to do this once
or to repeat the process to generate periodic interrupts. The scheduler uses this
mechanism to generate an interrupt that will preempt a process at the end of its
time slice.
The disk I/O subsystem uses it to invoke the flushing of dirty cache buffers to disk
periodically, and the network subsystem uses it to cancel operations that are
proceeding too slowly because of network congestion or failures. Hie operating
system may also provide an interface for user processes to use timers. The
operating system can support more timer requests than the number of timer
hardware channels by simulating virtual clocks. To do so, the kernel (or the timer
device driver) maintains a list of interrupts wanted by its own routines and by
user requests, sorted in earliest-time-first order. It sets the timer for the earliest
time. When the timer interrupts, the kernel signals the requester and reloads the
timer with the next earliest time.
from a highfrequency counter. In some computers, the value of this counter can
he read from a device register, in which case the counter can be considered a
highresolution clock. Although this clock does not generate interrupts, it offers
accurate measurements of time intervals.
One example is a user interface that receives keyboard and mouse input while
processing and displaying data on the screen. Another example is a video
application that reads frames from a file on disk while simultaneously
decompressing and displaying the output on the display. One way an application
writer can overlap execution with I/O is to write a multithreaded application.
Some threads can perform blocking system calls, while others continue executing.
The Solaris developers used this technique to implement a user-level library for
asynchronous I/O, freeing the application writer from that task. Some operating
systems provide nonblocking I/O system calls. A nonblocking call does not halt the
execution of the application for an extended time. Instead, it returns quickly, with
a return value that indicates how many bytes were transferred. An alternative to
a nonblocking system call is an asynchronous system call. An asynchronous call
returns immediately, without waiting for the I/O to complete. The application
continues to execute its code.
A good example of nonblocking behavior is the selec t () system call for network
sockets. This system call takes an argument that specifies a maximum waiting
time. By setting it to 0, an application can poll for network activity without
blocking. But using select() introduces extra overhead, because the selec t () call
only checks whether I/O is possible. For a data transfer, selectO must be followed
by some kind of readO or writeO command. A variation on this approach, found in
Mach, is a blocking multiple-read call. It specifies desired reads for several devices
in one system call and returns as soon as any one of them completes.
The kernel provides many services related to I/O. Several services such as
scheduling, caching, spooling, device reservation, and error handling – are
provided by the kernel, s I/O subsystem built on the hardware and device-driver
infrastructure. The I/O subsystem is also responsible for protecting itself from the
errant processes and malicious users.
1. I/O Scheduling –
To schedule a set of I/O request means to determine a good order in which
to execute them. The order in which application issues the system call are
the best choice. Scheduling can improve the overall performance of the
system, can share device access permission fairly to all the processes,
reduce the average waiting time, response time, turnaround time for I/O to
complete.
2. Buffering –
A buffer is a memory area that stores data being transferred between two
devices or between a device and an application. Buffering is done for three
reasons.
Q. After the system call returns, what happens if the application of the buffer
changes the content of the buffer?
Ans. With copy semantic, the version of the data written to the disk is guaranteed
to be the version at the time of the application system call.
3. Caching –
A cache is a region of fast memory that holds a copy of data. Access to the
cached copy is much easier than the original file. For instance, the
instruction of the currently running process is stored on the disk, cached in
physical memory, and copied again in the CPU’s secondary and primary
cache.
The main difference between a buffer and a cache is that a buffer may hold
only the existing copy of a data item, while cache, by definition, holds a
copy on faster storage of an item that resides elsewhere.
5. Error Handling –
An Os that uses protected memory can guard against many kinds of
hardware and application errors, so that a complete system failure is not
the usual result of each minor mechanical glitch, Devices, and I/O transfers
can fail in many ways, either for transient reasons, as when a network
becomes overloaded or for permanent reasons, as when a disk controller
becomes defective.
6. I/O Protection –
Errors and the issue of protection are closely related. A user process may
We know that there is handshaking between device driver and device controller
but here question is that how operating system connects application request or
we can say I/O request to set of network wires or to specific disk sector or we can
say to hardware -operations.
Example –
We are reading file from disk. The application we request for will refers to data by
file name. Within disk, file system maps from file name through file-system
directories to obtain space allocation for file. In MS-DOS, name of file maps to
number that indicates as entry in file-access table, and that entry to table tells us
that which disk blocks are allocated to file. In UNIX, name maps to inode number,
and inode number contains information about space-allocation. But here
question arises that how connection is made from file name to disk controller?
The method that is used by MS-DOS, is relatively simple operating system. The
first part of MS-DOS file name, is preceding with colon, is string that identifies
that there is specific hardware device.
The UNIX uses different method from MS-DOS. It represents device names in
regular file-system name space. Unlike MS-DOS file name, which has colon
separator, but UNIX path name has no clear separation of device portion. In fact,
no part of path name is name of device. Unix has mount table that associates with
prefixes of path names with specific hardware device names.
The typical life cycle of blocking read request, is shown in the following figure.
From figure, we can suggest that I/O operation requires many steps that together
consume large number of CPU cycles.
1. System call –
Whenever, any I/O request comes, process issues blocking read() system
call to previously opened file descriptor of file. Basically, role of system-call
code is to check parameters for correctness in kernel. If data we put in form
193 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
return codes to address space kernel moves process from wait queue back
to ready queue.
Protection
Need of Protection:
Role of Protection:
The role of protection is to provide a mechanism that implement policies which
defines the uses of resources in the computer system.Some policies are defined at
the time of design of the system, some are designed by management of the
system and some are defined by the users of the system to protect their own files
and programs.
Every application has different policies for use of the resources and they may
change over time so protection of the system is not only concern of the designer
of the operating system. Application programmer should also design the
protection mechanism to protect their system against misuse.
and place to place. Separation of mechanism and policy is important for the
flexibility of the system.
Access Matrix
F1 F2 F3 PRINTER
D1 read read
D2 print
D3 read execute
read read
D4 write write
According to the above matrix: there are four domains and four objects- three
files(F1, F2, F3) and one printer. A process executing in D1 can read files F1 and
F3. A process executing in domain D4 has same rights as D1 but it can also write
on files. Printer can be accessed by only one process executing in domain D2. The
mechanism of access matrix consists of many policies and semantic properties.
Specifically, We must ensure that a process executing in domain Di can access
only those objects that are specified in row i.
Association between the domain and processes can be either static or dynamic.
Access matrix provides an mechanism for defining the control for this association
between domain and processes. When we switch a process from one domain to
another, we execute a switch operation on an object(the domain). We can control
domain switching by including domains among the objects of the access matrix.
Processes should be able to switch from one domain (Di) to another domain (Dj) if
and only is a switch right is given to access(i, j).
F1 F2 F3 PRINTER D1 D2 D3 D4
D3 read execute
read read
D4 write write switch
Access Control
Access control is a method of guaranteeing that users are who they say they are
and that they have the appropriate access to company data.
Put another way: If your data could be of any value to someone without proper
authorization to access it, then your organization needs strong access control,
Crowley says.
The collection and selling of access descriptors on the dark web is a growing
problem. For example, a new report from Carbon Black describes how one
cryptomining botnet, Smominru, mined not only cryptcurrency, but also sensitive
information including internal IP addresses, domain information, usernames and
passwords. The Carbon Black researchers believe it is "highly plausible" that this
threat actor sold this information on an "access marketplace" to others who could
then launch their own attacks by remote access.
These access marketplaces "provide a quick and easy way for cybercriminals to
purchase access to systems and organizations.... These systems can be used as
zombies in large-scale attacks or as an entry point to a targeted attack," said the
report's authors. One access marketplace, Ultimate Anonymity Services (UAS)
offers 35,000 credentials with an average selling price of $6.75 per credential.
The Carbon Black researchers believe cybercriminals will increase their use of
access marketplaces and access mining because they can be "highly lucrative" for
them. The risk to an organization goes up if its compromised user credentials
have higher privileges than needed.
In the past, access control methodologies were often static. “Today, network
access must be dynamic and fluid, supporting identity and application-based use
cases,” Chesla says.
Enterprises must assure that their access control technologies “are supported
consistently through their cloud assets and applications, and that they can be
smoothly migrated into virtual environments such as private clouds,” Chesla
advises. “Access control rules must change based on risk factor, which means that
organizations must deploy security analytics layers using AI and machine learning
that sit on top of the existing network and security configuration. They also need
to identify threats in real-time and automate the access control rules
accordingly.”
With DAC models, the data owner decides on access. DAC is a means of assigning
access rights based on rules that users specify.
MAC was developed using a nondiscretionary model, in which people are granted
access based on an information clearance. MAC is a policy in which access rights
are assigned based on regulations from a central authority.
RBAC grants access based on a user’s role and implements key security principles,
such as “least privilege” and “separation of privilege.” Thus, someone attempting
to access information can only access data that’s deemed necessary for their role.
In ABAC, each resource and user are assigned a series of attributes, Wagner
explains. “In this dynamic method, a comparative assessment of the user’s
attributes, including time of day, position and location, are used to make a
decision on access to a resource.”
It’s imperative for organizations to decide which model is most appropriate for
them based on data sensitivity and operational requirements for data access. In
particular, organizations that process personally identifiable information (PII) or
other sensitive information types, including Health Insurance Portability and
Accountability Act (HIPAA) or Controlled Unclassified Information (CUI) data, must
make access control a core capability in their security architecture, Wagner
advises.
A number of technologies can support the various access control models. In some
cases, multiple technologies may need to work in concert to achieve the desired
level of access control, Wagner says.
“The reality of data spread across cloud service providers and SaaS applications
and connected to the traditional network perimeter dictate the need to
orchestrate a secure solution,” he notes. “There are multiple vendors providing
privilege access and identity management solutions that can be integrated into a
traditional Active Directory construct from Microsoft. Multifactor authentication
can be a component to further enhance security.”
• Partial versus total. Can a subset of the rights associated with an object be
revoked, or must we revoke all access rights for this object?
• Temporary versus permanent. Can access be revoked permanently (that is, the
revoked access right will never again be available), or can access be revoked and
later be obtained again? With an access-list scheme, revocation is easy.
The access list is searched for any access rights to be revoked, and they are
deleted from the list. Revocation is immediate and can be general or selective,
total or partial, and permanent or temporary. Capabilities, however, present a
much more difficult revocation problem. Since the capabilities are distributed
throughout the system, we must find them before we can revoke them. Schemes
that implement revocation for capabilities include the following:
• Indirection. The capabilities point indirectly, not directly, to the objects. Each
capability points to a unique entry in a global table, which in turn points to the
object. We implement revocation by searching the global table for the desired
entry and deleting it. Then, when an access is attempted, the capability is found
to point to an illegal table entry.
Table entries can be reused for other capabilities without difficulty, since both
the capability and the table entry contain the unique name of the object. The
object for a 14.8 Capability-Based Systems 547 capability and its table entry must
match. This scheme was adopted in the CAL system. It does not allow selective
revocation. Keys. A key is a unique bit pattern that can be associated with a
capability. Tliis key is defined when the capability is created, and it can be neither
modified nor inspected by the process owning the capability.
A master key is associated with each object; it can be defined or replaced with the
set-key operation. When a capability is created, the current value of the master
key is associated with the capability. When the capability is exercised, its key is
compared with the master key. If the keys match, the operation is allowed to
continue; otherwise, an exception condition is raised.
Revocation replaces the master key with a new value via the set-key operation,
invalidating all previous capabilities for this object. This scheme does not allowr
selective revocation, since only one master key is associated with each object. If
we associate a list of keys with each object, then selective revocation can be
implemented.
Finally, we can group all keys into one global table of keys. A capability is valid
only if its key matches some key in the global table. We implement revocation by
removing the matching key from the table. With this scheme, a key can be
associated with several objects, and several keys can be associated with each
object, providing maximum flexibility. In key-based schemes, the operations of
defining keys, inserting them into lists, and deleting them from lists should not be
available to all users. In particular, it would be reasonable to allow only the owner
of an object to set the keys for that object. This choice, however, is a policy
decision that the protection system can implement but should not define.
Threats
1. Program Threats:
A program written by a cracker to hijack the security or to change the
behaviour of a normal process.
2. System Threats:
These threats involve the abuse of system services. They strive to create a
situation in which operating-system resources and user files are misused.
They are also used as a medium to launch program threats.
1. Virus:
An infamous threat, known most widely. It is a self-replicating and a
malicious thread which attaches itself to a system file and then rapidly
replicates itself, modifying and destroying essential files leading to a system
breakdown.
2. Trojan Horse:
A code segment that misuses its environment is called a Trojan Horse. They
seem to be attractive and harmless cover program but are a really harmful
hidden program which can be used as the virus carrier. In one of the
versions of Trojan, User is fooled to enter its confidential login details on an
application. Those details are stolen by a login emulator and can be further
used as a way of information breaches.
Another variance is Spyware, Spyware accompanies a program that the user has
chosen to install and downloads ads to display on the user’s system, thereby
creating pop-up browser windows and when certain sites are visited by the user,
it captures essential information and sends it over to the remote server. Such
attacks are also known as Covert Channels.
3. Trap Door:
The designer of a program or system might leave a hole in the software
that only he is capable of using, the Trap Door works on the similar
principles. Trap Doors are quite difficult to detect as to analyze them, one
needs to go through the source code of all the components of the system.
4. Logic Bomb:
A program that initiates a security attack only under a specific situation.
1. Worm:
An infection program which spreads through networks. Unlike a virus, they
target mainly LANs. A computer affected by a worm attacks the target
system and writes a small program “hook” on it. This hook is further used
to copy the worm to the target computer. This process repeats recursively,
and soon enough all the systems of the LAN are affected. It uses the spawn
mechanism to duplicate itself. The worm spawns copies of itself, using up a
majority of system resources and also locking out all other processes.
2. Port Scanning:
It is a means by which the cracker identifies the vulnerabilities of the
system to attack. It is an automated process which involves creating a
TCP/IP connection to a specific port. To protect the identity of the attacker,
port scanning attacks are launched from Zombie Systems, that is systems
which were previously independent systems that are also serving their
owners while being used for such notorious purposes.
3. Denial of Service:
Such attacks aren’t aimed for the purpose of collecting information or
destroying system files. Rather, they are used for disrupting the legitimate
use of a system or facility.
These attacks are generally network based. They fall into two categories:
– Attacks in this first category use so many system resources that no useful
work can be performed.
For example, downloading a file from a website that proceeds to use all available
CPU time.
– Attacks in the second category involves disrupting the network of the facility.
These attacks are a result of the abuse of some fundamental TCP/IP principles.
fundamental functionality of TCP/IP.
Physical:
The sites containing computer systems must be physically secured against
armed and malicious intruders. The workstations must be carefully
protected.
Human:
Only appropriate users must have the authorization to access the system.
Phishing(collecting confidential information) and Dumpster
Diving(collecting basic information so as to gain unauthorized access) must
be avoided.
Operating system:
The system must protect itself from accidental or purposeful security
breaches.
Networking System:
Almost all of the information is shared between different systems via a
network. Intercepting these data could be just as harmful as breaking into a
computer. Henceforth, Network should be properly secured against such
attacks.
Usually, Anti Malware programs are used to periodically detect and remove such
viruses and threats. Additionally, to protect the system from the Network
Threats, Firewall is also be used.
Passive Network Threats: Activities such as wiretapping and idle scans that
are designed to intercept traffic traveling through the network.
Cryptography
Cryptography is the science to encrypt and decrypt data that enables the users to
store sensitive information or transmit it across insecure networks so that it can
be read only by the intended recipient.
Data which can be read and understood without any special measures is
called plaintext, while the method of disguising plaintext in order to hide its
substance is called encryption.
As the computing power is increasing day by day, one has to make the
encryption algorithms very strong in order to protect data and critical
information from the attackers.
Cryptography Techniques
Asymmetric Encryption − It is Public key cryptography that uses a pair of keys for
encryption: a public key to encrypt data and a private key for decryption. Public
key is published to the people while keeping the private key secret. For example,
RSA, Digital Signature Algorithm (DSA), Elgamal.
Authentication
Authentication refers to identifying each user of the system and associating the
executing programs with those users. It is the responsibility of the Operating
System to create a protection system which ensures that a user who is running a
particular program is authentic. Operating Systems generally
identifies/authenticates users using following three ways −
User card/key − User need to punch card in card slot, or enter key
generated by key generator in option provided by operating system to login
into the system.
Random numbers − Users are provided cards having numbers printed along
with corresponding alphabets. System asks for numbers corresponding to
few alphabets randomly chosen.
Secret key − User are provided a hardware device which can create a secret
id mapped with user id. System asks for such secret id which is to be
generated every time prior to login.
Program Threats
Trojan Horse − Such program traps user login credentials and stores them
to send to malicious user who can later on login to computer and can
access system resources.
1 Type A
2 Type B
3 Type C
4 Type D
Virtual Machine
Virtual machine technology is used for many use cases across on-premises and
cloud environments. More recently, public cloud services are using virtual
machines to provide virtual application resources to multiple users at once, for
even more cost efficient and flexible compute.
Virtual machines are easy to manage and maintain, and they offer several
advantages over physical machines:
While virtual machines have several advantages over physical machines, there are
also some potential disadvantages:
Virtual machines are less efficient and run slower than a full physical
computer. Most enterprises use a combination of physical and virtual
infrastructure to balance the corresponding advantages and
disadvantages.
Users can choose from two different types of virtual machines—process VMs and
system VMs:
a physical server’s disk space and CPU to manage the VMs. Hardware
virtualization, which is also known as server virtualization, allows hardware
resources to be utilized more efficiently and for one machine
to simultaneously run different operating systems.
A key benefit of containers is that they have less overhead compared to virtual
machines. Containers include only the binaries, libraries and other required
dependencies, and the application. Containers that are on the same host share
the same operating system kernel, making containers much smaller than virtual
machines. As a result, containers boot faster, maximize server
resources, and make delivering applications easier. Containers have
become popluar for use cases such as web applications, DevOps testing,
microservices and maximizing the number of apps that can be deployed per
server.
Virtual machines are larger and slower to boot than containers. They are logically
isolated from one another, with their own operating system kernel, and offer
the benefits of a completely separate operating system. Virtual machines are best
for running multiple applications together, monolithic applications, isolation
between apps, and for legacy apps running on older operating
systems. Containers and virtual machines may also be used together.
Virtualization
The first component is the OS Virtualization server. This server is the center point
in the OS Virtualization infrastructure. The server manages the streaming of the
information on the virtual disks for the client and also determines which client will
be connected to which virtual disk (using a database, this information is stored).
Also the server can host the storage for the virtual disk locally or the server is
connected to the virtual disks via a SAN (Storage Area Network). In high
availability environments there can be more OS Virtualization servers to create no
redundancy and load balancing. The server also ensures that the client will be
unique within the infrastructure.
Secondly, there is a client which will contact the server to get connected to the
virtual disk and asks for components stored on the virtual disk for running the
operating system.
The available supporting components are database for storing the configuration
and settings for the server, a streaming service for the virtual disk content, a
(optional) TFTP service and a (also optional) PXE boot service for connecting the
client to the OS Virtualization servers.
As it is already mentioned that the virtual disk contains an image of a physical disk
from the system that will reflect to the configuration and the settings of those
systems which will be using the virtual disk. When the virtual disk is created then
that disk needs to be assigned to the client that will be using this disk for starting.
The connection between the client and the disk is made through the
administrative tool and saved within the database. When a client has a assigned
disk, the machine can be started with the virtual disk using the following process
First we start the machine and set up the connection with the OS Virtualization
server. Most of the products offer several possible methods to connect with the
server. One of the most popular and used methods is using a PXE service, but also
a boot strap is used a lot (because of the disadvantages of the PXE service).
Although each method initializes the network interface card (NIC), receiving a
(DHCP-based) IP address and a connection to the server.
When the connection is established between the client and the server, the server
will look into its database for checking the client is known or unknown and which
virtual disk is assigned to the client. When more than one virtual disk are
connected then a boot menu will be displayed on the client side. If only one disk is
assigned, that disk will be connected to the client which is mentioned in step
number 3.
After the desired virtual disk is selected by the client, that virtual disk is connected
through the OS Virtualization server . At the back-end, the OS Virtualization server
makes sure that the client will be unique (for example computer name and
identifier) within the infrastructure.
As soon the disk is connected the server starts streaming the content of the
virtual disk. The software knows which parts are necessary for starting the
operating system smoothly, so that these parts are streamed first. The
information streamed in the system should be stored somewhere (i.e. cached).
Most products offer several ways to cache that information. For examples on the
client hard disk or on the disk of the OS Virtualization server.
5) Additional Streaming:
After that the first part is streamed then the operating system will start to run as
expected. Additional virtual disk data will be streamed when required for running
or starting a function called by the user (for example starting an application
available within the virtual disk).
Linux
Linux is one of popular version of UNIX operating System. It is open source as its
source code is freely available. It is free to use. Linux was designed considering
UNIX compatibility. Its functionality list is quite similar to that of UNIX.
Kernel − Kernel is the core part of Linux. It is responsible for all major
activities of this operating system. It consists of various modules and it
interacts directly with the underlying hardware. Kernel provides the
required abstraction to hide low level hardware details to system or
application programs.
Support code which is not required to run in kernel mode is in System Library.
User programs and other system programs works in User Mode which has no
access to system hardware and kernel code. User programs/ utilities use System
libraries to access Kernel functions to get system's low level tasks.
Basic Features
Architecture
Utilities − Utility programs that provide the user most of the functionalities
of an operating systems.
semantics, and the UNIX standard network model is implemented as a whole. The
internal characteristics of Linux design have been influenced by the history of the
development of this operating system.
There are many other standards in the UNIX world, but Linux’s full certification of
other UNIX standards sometimes becomes slow because it is more often available
at a certain price (not freely), and there is a price to pay if it involves certification
of approval or compatibility of an operating system with most standards .
Supporting broad applications is important for all operating systems so that the
implementation of the standard is the main goal of developing Linux even though
its implementation is not formally valid. In addition to the POSIX standard, Linux
currently supports POSIX thread extensions and subsets of extensions for POSIX
real-time process control.
2.1. Kernel
The Linux kernel forms the core of the Linux operating system. It provides all the
functions needed to run the process, and is provided with system services to
provide settings and protection for access to hardware resources. The kernel
implements all the features needed to work as an operating system. However, if
alone, the operating system provided by the Linux kernel is not at all similar to
UNIX systems. It does not have many extra UNIX features, and the features
provided are not always in the format expected by the UNIX application. The
interface of the operating system that is visible to the running application is not
maintained directly by the kernel. Instead, the application makes calls to the
system library, which then invokes the operating system services that are needed.
The system library provides many types of functions. At the easiest level, they
allow applications to make requests to the kernel system services. Making a
system call involves transferring controls from non-essential user mode to
important kernel mode; the details of this transfer are different for each
architecture. The library has the duty to collect system-call arguments and, if
necessary, arrange those arguments in the special form needed to make system
calls.
Libraries can also provide more complex versions of basic system calls. For
example, the buffered file-handling functions of the C language are all
implemented in the system library, which results in better control of file I / O than
those provided by the basic kernel system call. The library also provides routines
that have nothing to do with system calls, such as sorting algorithms,
mathematical functions, and string manipulation routines. All functions needed to
support the running of UNIX or POSIX applications are implemented in the system
library.
Linux systems contain many user-mode programs: system utilities and user
utilities. The system utilities include all the programs needed to initialize the
system, such as programs for configuring network devices or for loading kernel
modules. Server programs that are running continuously are also included as
system utilities; This kind of program manages user login requests, incoming
network connections, and printer queues.
Not all standard utilities perform important system administration functions. The
UNIX user environment contains a large number of standard utilities for doing
daily work, such as making directory listings, moving and deleting files, or showing
the contents of a file. More complex utilities can perform text-processing
functions, such as compiling textual data or performing pattern-searches on text
input. When combined, these utilities form the standard toolset expected by
users on any UNIX system; even if it doesn’t perform any operating system
functions, utilities are still an important part of a basic Linux system.
In this article we will cover the basics of process management in Linux. This topic
is of particular importance if you are responsible for administering a system which
has not yet been proven stable, that is not fully tested in its configuration. You
may find that as you run software, problems arise requiring administrator
intervention. This is the world of process management
Process Management
Any application that runs on a Linux system is assigned a process ID or PID. This is
a numerical representation of the instance of the application on the system. In
most situations this information is only relevant to the system administrator who
may have to debug or terminate processes by referencing the PID. Process
Management is the series of tasks a System Administrator completes to monitor,
manage, and maintain instances of running applications.
Multitasking
Each “turn” is called a time slice, and each time slice is only a fraction of a second
long. It is this rapid switching from process to process that allows a computer to
“appear’ to be doing two things at once, in much the same way a movie
“appears” to be a continuous picture.
Types of Processes
There are generally two types of processes that run on Linux. Interactive
processes are those processes that are invoked by a user and can interact with
the user. VI is an example of an interactive process. Interactive processes can be
classified into foreground and background processes. The foreground process is
the process that you are currently interacting with, and is using the terminal as its
stdin (standard input) and stdout (standard output). A background process is not
interacting with the user and can be in one of two states – paused or running.
The second general type of process that runs on Linux is a system process or
Daemon (day-mon). Daemon is the term used to refer to process’ that are running
on the computer and provide services but do not interact with the console. Most
server software is implemented as a daemon. Apache, Samba, and inn are all
examples of daemons.
Any process can become a daemon as long as it is run in the background, and
does not interact with the user. A simple example of this can be achieved using
the [ls –R] command. This will list all subdirectories on the computer, and is
similar to the [dir /s] command on Windows. This command can be set to run in
the background by typing [ls –R &], and although technically you have control
over the shell prompt, you will be able to do little work as the screen displays the
output of the process that you have running in the background. You will also
notice that the standard pause (ctrl+z) and kill (ctrl+c) commands do little to help
you.
Linux Scheduling
The Linux scheduler is a priority based scheduler that schedules tasks based upon
their static and dynamic priorities. When these priorities are combined they form
a task's goodness . Each time the Linux scheduler runs, every task on the run
queue is examined and its goodness value is computed. The task with the
highest goodness is chosen to run next.
When there are cpu bound tasks running in the system, the Linux scheduler may
not be called for intervals of up to .40 seconds. This means that the currently
running task has the CPU to itself for periods of up to .40 seconds (how long
depends upon the task's priority and whether it blocks or not). This is good for
throughput because there are few computationally uneccessary context switches.
However it can kill interactivity because Linux only reschedules when a task blocks
or when the task's dynamic priority (counter) reaches zero. Thus under Linux's
default priority based scheduling method, long scheduling latencies can occur.
Looking at the scheduling latency in finer detail, the Linux scheduler makes use of
a timer that interrupts every 10 msec. This timer erodes the currently running
task's dynamic priority (decrements its counter). A task's counter starts out at the
same value its priority contains. Once its dynamic priority (counter) has eroded to
0 it is again reset to that of its static priority (priority). It is only after the counter
reaches 0 that a call to schedule() is made. Thus a task with the default priority of
20 may run for .200 secs (200 msecs) before any other task in the system gets a
chance to run. A task at priority 40 (the highest priority allowed) can run for .400
secs without any scheduling occurring as long as it doesn't block or yield.
Linux scheduler has been gone through some big improvements since kernel
version 2.4. There were a lot of complaints about the interactivity of the
scheduler in kernel 2.4. During this version, the scheduler was implemented with
one running queue for all available processors. At every scheduling, this queue
was locked and every task on this queue got its timeslice update. This
implementation caused poor performance in all aspects. The scheduler algorithm
and supporting code went through a large rewrite early in the 2.5 kernel
development series. The new scheduler was arisen to achieveO(1 ) run-time
regardless number of runnable tasks in the system. To achieve this, each
processor has its own running queue. This helps a lot in reducing lock contention.
The priority array was introduced which used active array and expired array to
keep track running tasks in the system. TheO(1 ) running time is primarily drawn
from this new data structure. The scheduler puts all expired processes into
expired array. When there is no active process available in active array, it swaps
active array with expired array, which makes active array becomes expired array
and expired array becomes active array. There were some twists made into this
scheduler to optimize further by putting expired task back to active array instead
of expired array in some cases.O(1 ) scheduler uses a heuristic calculation to
update dynamic priority of tasks based on their interactivity (I/O bound versus
CPU bound) The industry was happy with this new scheduler until Con Kolivas
introduced his new scheduler named Rotating Staircase Deadline (RSDL) and then
later Staircase Deadline (SD). His new schedulers proved the fact that fair
scheduling among processes can be achieved without any complex computation.
His scheduler was designed to run inO(n ) but its performance exceeded the
currentO(1 ) scheduler.
The result achieved from SD scheduler surprised all kernel developers and
designers. The fair scheduling approach in SD scheduler encouraged Igno Molnar
to re-implement the new Linux scheduler named Completely Fair Scheduler (CFS).
CFS scheduler was a big improvement over the existing scheduler not only in its
performance and interactivity but also in simplifying the scheduling logic and
putting more modularized code into the scheduler. CFS scheduler was merged
into mainline version 2.6.23. Since then, there have been some minor
improvements made to CFS scheduler in some areas such as optimization, load
balancing and group scheduling feature.
A Global runqueue - All CPUs had to wait for other CPUs to finish execution.
A Global runqueue for all processors in a symmetric multiprocessing system
(SMP). This meant a task could be scheduled on any processor -- which can
be good for load balancing but bad for memory caches. For example,
suppose a task executed on CPU-1, and its data was in that processor's
cache. If the task got rescheduled to CPU-2, its data would need to be
invalidated in CPU-1 and brought into CPU-2 .
To make this process more efficient, a bitmap is used to define when tasks
are on a given priority list
The time it takes to find a task to execute depends not on the number of
active tasks but instead on the number of priorities
This makes the 2.6 scheduler an O(1) process because the time to schedule
is both fixed and deterministic regardless of the number of active tasks
The 2.6 scheduler was designed and implemented by Ingo Molnar. His
motivation in working on the new scheduler was to create a completely
O(1) scheduler for wakeup, context-switch, and timer interrupt overhead
One of the issues that triggered the need for a new scheduler was the use
of Java virtual machines (JVMs). The Java programming model uses many
threads of execution, which results in lots of overhead for scheduling in an
O(n) scheduler
Each CPU has a runqueue made up of 140 priority lists that are serviced in
FIFO order. Tasks that are scheduled to execute are added to the end of
their respective runqueue's priority list
Each task has a time slice that determines how much time it's permitted to
execute
The first 100 priority lists of the runqueue are reserved for real-time tasks,
and the last 40 are used for user tasks (MAX_RT_PRIO=100 and
MAX_PRIO=140)
When a task on the active runqueue uses all of its time slice, it's moved to
the expired runqueue. During the move, its time slice is recalculated (and
so is its priority)
If no tasks exist on the active runqueue for a given priority, the pointers for
the active and expired runqueues are swapped, thus making the expired
priority list the active one
3. Not pre-empted !!
2. Once all RR tasks of a given prio(rity) level exhaust their timeslices, their
timeslices are refilled and they continue running
The main idea behind the CFS is to maintain balance (fairness) in providing
processor time to tasks. This means processes should be given a fair
amount of the processor. When the time for tasks is out of balance
(meaning that one or more tasks are not given a fair amount of time
relative to others), then those out-of-balance tasks should be given time to
execute.
To determine the balance, the CFS maintains the amount of time provided to a
given task in what's called the virtual runtime. The smaller a task's virtual
runtime—meaning the smaller amount of time a task has been permitted access
to the processor—the higher its need for the processor. The CFS also includes the
concept of sleeper fairness to ensure that tasks that are not currently runnable
(for example, waiting for I/O) receive a comparable share of the processor when
they eventually need it.
But rather than maintain the tasks in a run queue, as has been done in prior Linux
schedulers, the CFS maintains a time-ordered red-black tree (see Figure below).
A red-black tree is a tree with a couple of interesting and useful properties. First,
it's self-balancing, which means that no path in the tree will ever be more than
twice as long as any other. Second, operations on the tree occur in O(log n) time
(where n is the number of nodes in the tree). This means that you can insert or
delete a task quickly and efficiently.
Load balancer: In SMP environment, each CPU has its own rq. These
queues might be unbalanced from time to time. A running queue with
empty task pushes its associated CPU to idle, which does not take full
advantage of symmetric multiprocessor systems. Load balancer is to
address this issue. It is called every time the system requires scheduling
tasks. If running queues are unbalanced, load balancer will try to pull idle
tasks from busiest processors to idle processor.
Interactivity
Interactivity is an important goal for the Linux scheduler, especially given the
growing effort to optimize Linux for desktop environments. Interactivity often
flies in the face of efficiency, but it is very important nonetheless. An example of
interactivity might be a keystroke or mouse click. Such events usually require a
quick response (i.e. the thread handling them should be allowed to execute very
soon) because users will probably notice and be annoyed if they do not see some
result from their action almost immediately. Users don’t expect a quick response
when, for example, they are compiling programs or rendering high-resolution
images. They are unlikely to notice if something like compiling the Linux kernel
takes an extra twenty seconds. Schedulers used for interactive computing should
be designed in such a way that they respond to user interaction within a certain
time period. Ideally, this should be a time period that is imperceptible to users
and thus gives the impression of an immediate response.
Interactivity estimator
Interactive tasks are I/O bound. They wait for events to occur.
To avoid delays, interactive tasks may be re-inserted into the 'active' array
after their timeslice has expired
Timeslice distribution:
A task of equal priority may preempt the running task every 20ms
Memory Management
The memory management in Linux is a complex system that evolved over the
years and included more and more functionality to support a variety of systems
from MMU-less microcontrollers to supercomputers. The memory management
for systems without an MMU is called nommu and it definitely deserves a
dedicated document, which hopefully will be eventually written. Yet, although
some of the concepts are the same, here we assume that an MMU is available
and a CPU can translate a virtual address to a physical address.
some equivalent storage type. There may be below reasons for maintaining the
file system:
o Primarily the computer saves data to the RAM storage; it may lose the data
if it gets turned off. However, there is non-volatile RAM (Flash RAM and
SSD) that is available to maintain the data after the power interruption.
o A specific data storage format (EXT3, EXT4, BTRFS, XFS and so on)
Linux file system is generally a built-in layer of a Linux operating system used to
handle the data management of the storage. It helps to arrange the file on the
disk storage. It manages the file name, file size, creation date, and much more
information about a file.
Linux file system has a hierarchal file structure as it contains a root directory and
its subdirectories. All other directories can be accessed from the root directory. A
partition usually has only one file system, but it may have more than one file
system.
A file system is designed in a way so that it can manage and provide space for
non-volatile storage data. All file systems required a namespace that is a naming
Also, it stores advanced information about the section of the disk, such as
partitions and volumes.
The advanced data and the structures that it represents contain the information
about the file system stored on the drive; it is distinct and independent of the file
system metadata.
The file system requires an API (Application programming interface) to access the
function calls to interact with file system components like files and
directories. API facilitates tasks such as creating, deleting, and copying the files. It
facilitates an algorithm that defines the arrangement of files on a file system.
The first two parts of the given file system together called a Linux virtual file
system. It provides a single set of commands for the kernel and developers to
access the file system. This virtual file system requires the specific system driver
to give an interface to the file system.
In Linux, the file system creates a tree structure. All the files are arranged as a
tree and its branches. The topmost directory called the root (/) directory. All
other directories in Linux can be accessed from the root directory.
o Specifying paths: Linux does not use the backslash (\) to separate the
components; it uses forward slash (/) as an alternative. For example, as in
Windows, the data may be stored in C:\ My Documents\ Work, whereas, in
Linux, it would be stored in /home/ My Document/ Work.
o Partition, Directories, and Drives: Linux does not use drive letters to
organize the drive as Windows does. In Linux, we cannot tell whether we
are addressing a partition, a network device, or an "ordinary" directory and
a Drive.
o File Extensions: In Linux, a file may have the extension '.txt,' but it is not
necessary that a file should have a file extension. While working with Shell,
it creates some problems for the beginners to differentiate between files
and directories. If we use the graphical file manager, it symbolizes the files
and folders.
o Hidden files: Linux distinguishes between standard files and hidden files,
mostly the configuration files are hidden in Linux OS. Usually, we don't
need to access or read the hidden files. The hidden files in Linux are
represented by a dot (.) before the file name (e.g., .ignore). To access the
files, we need to change the view in the file manager or need to use a
specific command in the shell.
When we install the Linux operating system, Linux offers many file systems such
as Ext, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS, btrfs, and swap.
The file system Ext stands for Extended File System. It was primarily developed
for MINIX OS. The Ext file system is an older version, and is no longer used due to
some limitations.
Ext2 is the first Linux file system that allows managing two terabytes of data. Ext3
is developed through Ext2; it is an upgraded version of Ext2 and contains
backward compatibility. The major drawback of Ext3 is that it does not support
servers because this file system does not support file recovery and disk snapshot.
Ext4 file system is the faster file system among all the Ext file systems. It is a very
compatible option for the SSD (solid-state drive) disks, and it is the default file
system in Linux distribution.
JFS stands for Journaled File System, and it is developed by IBM for AIX Unix. It is
an alternative to the Ext file system. It can also be used in place of Ext4, where
stability is needed with few resources. It is a handy file system when CPU power is
limited.
XFS file system was considered as high-speed JFS, which is developed for parallel
I/O processing. NASA still using this file system with its high storage server (300+
Terabyte server).
Btrfs stands for the B tree file system. It is used for fault tolerance, repair system,
fun administration, extensive storage configuration, and more. It is not a good
suit for the production system.
The swap file system is used for memory paging in Linux operating system during
the system hibernation. A system that never goes in hibernate state is required to
have swap space equal to its RAM size.
To the user, the I/O system in Linux looks much like that in any UNIX system. That
is, to the extent possible, all device drivers appear as normal files. A user can open
an access channel to a device in the same way she opens any other file—devices
can appear as objects within the file system.
The system administrator can create special files within a file system that contain
references to a specific device driver, and a user opening such a file will be able to
read from and write to the device referenced. By using the normal file-protection
system, which determines who can access which file, the administrator can set
access permissions for each device. Linux splits all devices into three classes: block
devices, character devices, and network devices.
Figure 21.10 illustrates the overall structure of the device-driver system. Block
devices include all devices that allow random access to completely independent,
fixed-sized blocks of data, including hard disks and floppy disks, CD-ROMs, and
flash memory. Block devices are typically used to store file systems, but direct
access to a block device is also allowed so that programs can create and repair the
file system that the device contains.
Applications can also access these block devices directly if they wish; for example,
a database application may prefer to perform its own, fine-tuned laying out of
data onto the disk, rather than using the general-purpose file system. Character
devices include most other devices, such as mice and keyboards. The fundamental
difference between block and character devices is random access—block devices
may be accessed randomly, while character devices are only accessed serially.
For example, seeking to a certain position in a file might be supported for a DVD
but makes no sense to a pointing device such as a mouse. Network devices are
dealt with differently from block and character devices. Users cannot directly
transfer data to network devices; instead, they must communicate indirectly by
opening a connection to the kernel's networking subsystem. We discuss the
interface to network devices separately in Section 21.10.
Block Devices
Block devices provide the main interface to all disk devices in a system.
Performance is particularly important for disks, and the block-device system must
provide functionality to ensure that disk access is as fast as possible. This
functionality is achieved through the scheduling of I/O operations In the context
of block devices, a block represents the unit with which the kernel performs I/O.
When a block is read into memory, it is stored in a buffer. The request manager is
the layer of software that manages the reading and writing of buffer contents to
and from a block-device driver. A separate list of requests is kept for each block-
device driver. Traditionally, these requests have been scheduled according to a
unidirectional-elevator (C-SCAN) algorithm that exploits the order in which
requests are inserted in and removed from the per-device lists. The request lists
The deadline I/O scheduler used in version 2.6 works similarly to the elevator
algorithm except that it also associates a deadline with each request, thus
addressing the starvation issue. By default, the deadline for read requests is 0.5
second and that for write requests is 5 seconds. The deadline scheduler maintains
a sorted queue of pending I/O operations sorted by sector number. However, it
also maintains two other queues—a read queue for read operations and a write
queue for write operations. These two queues are ordered according to deadline.
Every I/O request is placed in both the sorted queue and either the read or the
write queue, as appropriate. Ordinarily, I/O operations occur from the sorted
queue. However, if a deadline expires for a request in either the read or the write
queue, I/O operations are scheduled from the queue containing the expired
request. This policy ensures that an I/O operation will wait no longer than its
expiration time
Character Devices
A character-device driver can be almost any device driver that does not offer
random access to fixed blocks of data. Any character-device drivers registered to
the Linux kernel must also register a set of functions that implement the file I/O
operations that the driver can handle. The kernel performs almost no
preprocessing of a file read or write request to a character device; it simply passes
the request to the device in question and lets the device deal with the request.
The main exception to this rule is the special subset of character-device drivers
that implement terminal devices. The kernel maintains a standard interface to
these drivers by means of a set of tty_struc t structures. Each of these structures
provides buffering and flow control on the data stream from the terminal device
and feeds those data to a line discipline.
A line discipline is an interpreter for the information from the terminal device.
The most common line discipline is the tt y discipline, which glues the terminal's
data stream onto the standard input and output streams of a user's running
processes, allowing those processes to communicate directly with user's terminal.
This job is complicated by the fact that several such processes may be running
simultaneously, and the tt y line discipline is responsible for attaching and
detaching the terminal's input and output from the various processes connected
to it as those processes are suspended or awakened by the user.
Other line disciplines also are implemented that have nothing to do with I/O to a
user process. The PPP and SLIP networking protocols are ways of encoding a
networking connection over a terminal device such as a serial line. These
protocols are implemented under Linux as drivers that at one end appear to the
terminal system as line disciplines and at the other end appear to the networking
system as network-device drivers. After one of these line disciplines has been
enabled on a terminal device, any data appearing on that terminal will be routed
directly to the appropriate network-device driver.
3. Message Queuing –
This allows messages to be passed between processes using either a single
queue or several message queue. This is managed by system kernel these
messages are coordinated using an API.
4. Semaphores –
This is used in solving problems associated with synchronization and to
avoid race condition. These are integer values which are greater than or
equal to 0.
5. Shared memory –
This allows the interchange of data through a defined area of memory.
Semaphore values have to be obtained before data can get access to
shared memory.
6. Sockets –
This method is mostly used to communicate over a network between a
client and a server. It allows for a standard connection which is computer
and OS independent.
In practice, the networking capabilities of Neutron are somewhat limited, with its
main drawback being a lack of scalability. While companies may use Neutron in a
lab environment, when it comes to production they typically look for other
options.
History of Windows
Early History
Bill Gates is known as the founder of Windows. Microsoft was founded by Bill
Gates and Paul Allen, the childhood friends on 4 April 1975 in Albuquerque, New
Mexico, U.S.
The first project towards the making of Windows was Interface Manager.
Microsoft was started to work on this program in 1981, and in November 1983, it
was announced under the name "Windows," but Windows 1.0 was not released
until November 1985. It was the time of Apple's Macintosh, and that's the reason
Windows 1.0 was not capable of competing with Apple's operating system, but it
achieved little popularity. Windows 1.0 was just an extension of MS-DOS (an
already released Microsoft's product), not a complete operating system. The first
Microsoft Windows was a graphical user interface for MS-DOS. But, in the later
1990s, this product was evolved as a fully complete and modern operating
system.
Windows Versions
The first version of Windows was Windows 1.0. It cannot be called a complete
operating system because it was just an extension of MS-DOS, which was already
developed by Microsoft. The shell of Windows 1.0 was a program named MS-DOS
Executive. Windows 1.0 had introduced some components like Clock, Calculator,
Calendar, Clipboard viewer, Control Panel, Notepad, Paint, Terminal, and Write,
etc.
The early versions of Windows acted as graphical shells because they ran on top
of MS-DOS and used it for file system services.
Windows 3.x
The third major version of Windows was Windows 3.0. It was released in 1990
and had an improved design. Two other upgrades were released as Windows 3.1
and Windows 3.2 in 1992 and 1994, respectively. Microsoft tasted its first broad
commercial success after the release of Windows 3.x and sold 2 million copies in
just the first six months of release.
Windows NT (3.1/3.5/3.51/4.0/2000)
Windows XP
Windows XP was the next major version of Windows NT. It was first released on
25 October 2001. It was introduced to add security and networking features.
256 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5
It was the first Windows version that was marketed in two main editions: the
"Home" edition and the "Professional" edition.
The "Home" edition was targeted towards consumers for personal computer use,
while the "Professional" edition was targeted towards business environments and
power users. It included the "Media Center" edition later, which was designed for
home theater PCs and provided support for DVD playback, TV tuner cards, DVR
functionality, and remote controls, etc.
Windows Vista
Windows 7
Windows 7 and its Server edition Windows Server 2008 R2 were released as RTM
on 22 July 2009. Three months later, Windows 7 was released to the public.
Windows 7 had introduced a large number of new features, such as a redesigned
Windows shell with an updated taskbar, multi-touch support, a home networking
system called HomeGroup, and many performance improvements.
Microsoft released its newer version Windows 8.1 on 17 October 2013 and
includes features such as new live tile sizes, deeper OneDrive integration, and
many other revisions.
Windows 8 and Windows 8.1 were criticized for the removal of the Start menu.
Windows 10
Microsoft has not announced any newer version of Windows after Windows 10.
Design Principles
Microsoft's design goals for Windows XP include security, reliability, Windows and
POSIX application compatibility, high performance, extensibility, portability, and
international support.
Security
Windows XP security goals required more than just adherence to the design
standards that enabled Windows NT 4.0 to receive a C-2 security classification
from the U.S. government (which signifies a moderate level of protection from
defective software and malicious attacks).
Extensive code review and testing were combined with sophisticated automatic
analysis tools to identify and investigate potential defects that might represent
security vulnerabilities.
Reliability
Windows 2000 was the most reliable, stable operating system Microsoft had ever
shipped to that point. Much of this reliability came from maturity in the source
code, extensive stress testing of the system, and automatic detection of many
serious errors in drivers.
The reliability requirements for Windows XP were even more stringent. Microsoft
used extensive manual and automatic code review to identify over 63,000 lines in
the source files that might contain issues not detected by testing and then set
about reviewing each area to verify that the code was indeed correct.
Windows XP extends driver verification to catch more subtle bugs, improves the
facilities for catching programming errors in user-level code, and subjects third-
party applications, drivers, and devices to a rigorous certification process.
Furthermore, Windows XP adds new facilities for monitoring the health of the PC,
including downloading fixes for problems before they are encountered by users.
The perceived reliability of Windows XP was also improved by making the
graphical user interface easier to use through better visual design, simpler menus,
and measured improvements in the ease with which users can discover how to
perform common tasks.
High Performance
Extensibility
In addition, Windows XP uses loadable drivers in the I/O system, so new file
systems, new kinds of I/O devices, and new kinds of networking can be added
while the system is running. Windows XP uses a client-server model like the Mach
operating system and supports distributed processing by remote procedure calls
(RPCs) as defined by the Open Software Foundation.
Portability
A DLL is a file that is mapped into a process's address space such that any
functions in the DLL appear to be part of the process. The upper layers of the
Windows XP kernel depend on the HAL interfaces rather than on the underlying
hardware, bolstering Windows XP portability. The HAL manipulates hardware
directly, isolating the rest of Windows XP from hardware differences among the
platforms on which it runs.
Although for market reasons Windows 2000 shipped only on Intel IA32-
compatible platforms, it was also tested on IA32 and DEC Alpha platforms until
just prior to release to ensure portability. Windows XP runs on IA32-compatible
and IA64 processors. Microsoft recognizes the importance of multiplatform
development and testing, since, as a practical matter, maintaining portability is a
matter of use it or lose it.
International Support
String comparisons are specialized to account for varying character sets. UNICODE
is Windows XP's native character code. Windows XP supports ANSI characters by
converting them to UNICODE characters before manipulating them (8-bit to 16-bit
conversion). System text strings are kept in resource files that can be replaced to
localize the system for different languages. Multiple locales can be used
concurrently, which is important to multilingual individuals and businesses.
The main components of the Windows Operating System are the following:
Networking
Scripting and command-line
Kernel
NET Framework
Security
Deprecated components and apps
APIs
Windows allows multiple users to have their own profile set-ups associated with
their account. These profiles are usually password protected, and their settings,
files and other information are set up to meet each individual user's needs.
Setting up different profiles allows multiple users to share one computer.
However, there is often a delay when logging in and out of different accounts.
This is where fast user switching comes in.
Terminal Services
Widely used these days with Microsoft Windows Server 2003, Terminal
Services provides the ability to host multiple, simultaneous client sessions.
Time is money...
This goes in hand with IT budgets and staffing. Managing software in a central
location is usually much faster, easier, and cheaper than deploying applications to
end-users' desktops. Centrally-deployed applications are also easier to maintain,
especially as related to patching and upgrading.
Running applications from one central location also can be beneficial for the
configuration of desktops. Since a terminal server hosts all the application logic
which also runs on the server, the processing and storage requirements for client
machines are minimal.
Both the underlying protocol as well as the service was again fundamentally
overhauled for Windows Vista and Windows Server 2008.
Windows includes the following two client applications which utilize Terminal
Services:
Remote Assistance
Remote Desktop
In the client versions of Windows, that is for example Windows XP, Terminal
Services supports only one logged in user at a time. On the other hand,
concurrent remote sessions are allowed in a server Windows operating system,
for example the Microsoft Windows Server 2003.
As one may expect, running an application from a central location also has some
disadvantages.
The terminal server is the major source of risk of downtime. If the terminal
server fails, the whole system fails unless a fail-over terminal server is in
place.
Terminal Services can be configured and managed through Group Policy settings.
This is a new feature in Windows Server 2003 which allows administrators to take
advantage of the flexibility and power of the Group Policy component to simplify
the configuration and management of Windows Terminal servers. User accounts
can be assigned permissions based on group policies.
The remote administration mode is already built into the operating system and no
longer requires installation of additional components. Allowing users to remotely
The Remote Desktop Protocol (RDP) has been very much enhanced in Windows
Server 2003. The display and device redirection as well as the security have been
enhanced. Terminal Services does not need a VPN tunnel anymore when
connecting to it over a public network.
In computing, file system controls how data is stored and retrieved. In other
words, it is the method and data structure that an operating system uses to keep
track of files on a disk or partition.
It separates the data we put in computer into pieces and gives each piece a name,
so the data is easily isolated and identified.
Without file system, information saved in a storage media would be one large
body of data with no way to tell where the information begins and ends.
There are five types of Windows file system, such as FAT12, FAT16, FAT32, NTFS
and exFAT. Most of us like to choose the latter three, and I would like to
introduce them respectively for you.
FAT32 in Windows
In order to overcome the limited volume size of FAT16 (its supported maximum
volume size is 2GB) Microsoft designed a new version of the file system FAT32,
which then becomes the most frequently used version of the FAT (File Allocation
Table) file system.
NTFS in Windows
NTFS is the newer drive format. Its full name is New Technology File System.
Starting with Windows NT 3.1, it is the default file system of the Windows
NT family.
Microsoft has released five versions of NTFS, namely v1.0, v1.1, v1.2, v3.0, and
v3.1.
exFAT in Windows
exFAT (Extended File Allocation Table) was designed by Microsoft back in 2006
and was a part of the company's Windows CE 6.0 operating system.
This file system was created to be used on flash drives like USB memory sticks and
SD cards, which gives a hint for its precursors: FAT32 and FAT16.
Compatibility
For FAT32, it also works in game consoles and particularly anything with a USB
port; for exFAT, it requires additional software on Linux; for NTFS, it is read only
by default with Mac, and may be read only by default with some Linux
distributions.
With respect to the ideal use, FAT32 is used on removable drives like USB and
Storage Card; exFAT is used for USB flash drives and other external drivers,
especially if you need files of more than 4 GB in size; NTFS can be used for servers.
Security
The files belonging to FAT32 and NTFS can be encrypted, but the flies belong to
the latter can be compressed.
The encryption and compression in Windows are very useful. If other users do not
use your user name to login Windows system, they will fail to open the encrypted
and compressed files that created with your user name.
In other word, after some files are encrypted, such files only can be opened when
people use our account to login Windows system.
Distributed Systems
A distributed system contains multiple nodes that are physically separate but
linked together using the network. All the nodes in this system communicate with
each other and handle processes in tandem. Each of these nodes contains a small
part of the distributed operating system software.
The nodes in the distributed systems can be arranged in the form of client/server
systems or peer to peer systems. Details about these are as follows −
Client/Server Systems
In client server systems, the client requests a resource and the server provides
that resource. A server may serve multiple clients at the same time while a client
is in contact with only one server. Both the client and server usually communicate
via a computer network and so they are a part of distributed systems.
The peer to peer systems contains nodes that are equal participants in data
sharing. All the tasks are equally divided between all the nodes. The nodes
interact with each other as required as share resources. This is done with the help
of a network.
All the nodes in the distributed system are connected to each other. So
nodes can easily share data with other nodes.
More nodes can easily be added to the distributed system i.e. it can be
scaled as required.
Failure of one node does not lead to the failure of the entire distributed
system. Other nodes can still communicate with each other.
Resources like printers can be shared with multiple nodes rather than being
restricted to just one.
Some messages and data can be lost in the network while moving from one
node to another.
Overloading may occur in the network if all the nodes of the distributed
system try to send data at once.
Unlike operating systems, such as Windows, that are designed for single users to
control one computer, network operating systems (NOS) coordinate the activities
The term network operating system is used to refer to two rather different
concepts:
Examples:
Advantages
New technology and hardware can be easily integrated into the system.
Servers are able to be accessed remotely from different locations and types
of systems.
Disadvantages
Ease of setup
Advantages
Disadvantages
o Resource sharing
(but not as easily as if on the same machine)
o Enhanced performance
(but 2 machines are not as good as a single machine that is 2 times as
fast)
o Modular expandability
System models:
the workstation model (each user has a workstation, the system provides
some common services, such as a distributed file system).
distributed applications
Naming
Scalability
Compatibility
Execution level: same source code can be compiled and executed (source
code).
Process synchronization
Data migration: data are brought to the location that needs them.
Security
Authorization: deciding what privileges an entity has and making only those
privileges available.
Structuring
client-server: servers provide the services and clients use the services.
Communication Networks
Most distributed operating systems are not concerned with the lower layer
communication primitives.
Communication Models
message passing
#include <sys/socket.h>
size_t *address_len);
int timeout);
RPC
With message passing, the application programmer must worry about many
details:
parsing messages
RPC Issues
Binding method
RPC Diagram
Communication Protocols
the equivalent layer on other systems. Typically, each layer has its own protocols,
and communication takes place between peer layers using a specific protocol. The
protocols may be implemented in hardware or software.
For instance, Figure 16.6 shows the logical communications between two
computers, with the three lowest-level layers implemented in hardware.
Following the International Standards Organization (ISO), we refer to the layers as
follows:
1. Physical layer. The physical layer is responsible for handling both the
mechanical and the electrical details of the physical transmission of a bit
stream. At the physical layer, the communicating systems must agree on
the electrical representation of a binary 0 and 1, so that when data are
2.
Figure 16.7 summarizes the ISO protocol stack—a set of cooperating protocols—
showing the physical flow of data. As mentioned, logically each layer of a protocol
stack communicates with the equivalent layer on other systems. But physically, a
message starts at or above the application layer and is passed through each lower
level in turn. Each layer may modify the message and include message-header
data for the equivalent layer on the receiving side. Ultimately, the message
reaches the data-network layer and is transferred as one or more packets (Figure
16.8).
The data-link layer of the target system receives these data, and the message is
moved up through the protocol stack; it is analyzed, modified, and stripped of
headers as it progresses. It finally reaches the application layer for use by the
receiving process.
The ISO model formalizes some of the earlier work done in network protocols but
was developed in the late 1970s and is currently not in widespread use. Perhaps
the most widely adopted protocol stack is the TCP/IP model, which has been
adopted by virtually all Internet sites. The TCP/IP protocol stack has fewer layers
than does the ISO model. Theoretically, because it combines several functions in
each layer, it is more difficult to implement but more efficient than ISO
networking. The relationship between the ISO and TCP/IP models is shown in
Figure 16.9.
The TCP/IP application layer identifies several protocols in widespread use in the
Internet, including HTTP, FTP, Telnet, DNS, and SMTP. The transport layer
identifies the unreliable, connectionless user datagram protocol (UDP) and the
reliable, connection-oriented transmission control protocol (TCP). The Internet
protocol (IP) is responsible for routing IP datagrams through the Internet. The
TCP/IP model does not formally identify a link or physical layer, allowing TCP/IP
traffic to run across any physical network. In Section 16.9, we consider the TCP/IP
model running over an Ethernet network.
5. Failure Handling : When some faults occur in hardware and the software
program, it may produce incorrect results or they may stop before they
have completed the intended computation so corrective measures should
to implemented to handle this case.
A distributed file system (DFS) is a file system with data stored on a server. The
data is accessed and processed as if it was stored on the local client machine. The
DFS makes it convenient to share information and files among users on a network
in a controlled and authorized way. The server allows the client users to share
files and store data just like they are storing the information locally. However, the
servers have full control over the data and give access control to the clients.
Distributed file system (DFS) is a method of storing and accessing files based in
a client/server architecture. In a distributed file system, one or more central
servers store files that can be accessed, with proper authorization rights, by any
number of remote clients in the network.
stored locally on the workstation. When the user finishes working with the file, it
is returned over the network to the server, which stores the now-altered file for
retrieval at a later time.
One process involved in implementing the DFS is giving access control and storage
management controls to the client system in a centralized way, managed by the
servers. Transparency is one of the core processes in DFS, so files are accessed,
stored, and managed on the local client machines while the process itself is
actually held on the servers. This transparency brings convenience to the end user
on a client machine because the network file system efficiently manages all the
processes. Generally, a DFS is used in a LAN, but it can be used in a WAN or over
the Internet.
A DFS allows efficient and well-managed data and storage sharing options on a
network compared to other options. Another option for users in network-based
computing is a shared disk file system. A shared disk file system puts the access
control on the client’s systems so the data is inaccessible when the client system
goes offline. DFS is fault-tolerant and the data is accessible even if some of the
network nodes are offline.
A DFS makes it possible to restrict access to the file system depending on access
lists or capabilities on both the servers and the clients, depending on how the
protocol is designed.
2020
Answer: d Answer: d
Explanation: Upgrades is the right term to Explanation: The programs included in a
be used. Upgrades are installed to renew or system software package are called system
implement a new feature. Except for programs. The programmers who design
upgrades, hardware is normally one-time them and prepare them are called system
expense. programmers.
task. c) Blocked
a) Application Software d) Execution
b) System Software
Answer: c
c) Utility Software
Explanation: There is no blocked state in a
d) User
process model. The different states are
Answer: a ready, running, executing, waiting and
Explanation: An application software is terminated.
specific to solving a specific problem.
11. The language made up of binary coded
System software is designed for controlling
instructions.
the operations of a computer system.
a) Machine
8. Assembler is used as a translator for? b) C
a) Low level language c) BASIC
b) High Level Language d) High level
c) COBOL
Answer: a
d) C
Explanation: The language made up of
Answer: a binary coded instructions built into the
Explanation: Assembler is used in case of hardware of a particular computer and used
low level languages. It is generally used to directly by the computer is machine
make the binary code into an language.
understandable format. Interpreter is used
12. Binary code comprises of digits from 0
with the high level languages similarly.
to 9.
9. What do you call a program in execution? a) True
a) Command b) False
b) Process
Answer: b
c) Task
Explanation: The statement is false. Binary
d) Instruction
as the word suggests contains only 2 digits :
Answer: b 0 and 1.
Explanation: Option Process is correct. A 0 denotes false and 1 denotes a truth value.
program is a set of instructions. A program
13. The ___________ contains the address
in execution is called a process.
of the next instruction to be executed.
10. Which of the following is not a process a) IR
state? b) PC
a) Terminated c) Accumulator
b) Running d) System counter
Answer: b Answer: a
Explanation: PC stands for program counter Explanation: The statement is true.
(It contains the address of the next Advantages of using assembly language are:
instruction to be executed). • It requires less memory and execution
time.
14. A document that specifies how many
• It allows hardware-specific complex jobs
times and with what data the program must
in an easier way.
be run in order to thoroughly test it.
• It is suitable for time-critical jobs.
a) addressing plan
b) test plan 17. The data size of a word is _________
c) validation plan a) 2-byte
d) verification plan b) 4-byte
c) 8-byte
Answer: b
d)16-byte
Explanation: Test plan is the A document
that specifies how many times and with Answer: a
what data the program must be run in Explanation: The processor supports the
order to thoroughly test it. It comes under following data sizes:
testing. • Word: a 2-byte data item
• Double word: a 4-byte (32 bit) data item,
15. Each personal computer has a
etc.
_________ that manages the computer’s
arithmetical, logical and control activities. 18. A direct reference of specific location.
a) Microprocessor a) Segment Address
b) Assembler b) Absolute Address
c) Microcontroller c) Offset
d) Interpreter d) Memory Address
Answer: a Answer: b
Explanation: Microprocessor handles all Explanation: There are two kinds of
these activities. Each family of processors memory addresses:
has its own set of instructions for handling • An absolute address – a direct reference
various operations like getting input from of specific location.
keyboard, displaying information on a • The segment address (or offset) – starting
screen and performing various other jobs. address of a memory segment with the
offset value.
16. Assembly Language requires less
memory and execution time. 19. A Borland Turbo Assembler.
a) True a) nasm
b) False b) tasm
26. To access the services of operating c) to handle the files in operating system
system, the interface is provided by the d) none of the mentioned
___________
Answer: a
a) System calls
Explanation: None.
b) API
c) Library 30. By operating system, the resource
d) Assembly instructions management can be done via __________
a) time division multiplexing
Answer: a
b) space division multiplexing
Explanation: None.
c) time and space division multiplexing
27. Which one of the following is not true? d) none of the mentioned
a) kernel is the program that constitutes the
Answer: c
central core of the operating system
Explanation: None.
b) kernel is the first part of operating
system to load into memory during booting 31. If a process fails, most operating system
c) kernel is made of various modules which write the error information to a ______
can not be loaded in running operating a) log file
system b) another running process
d) kernel remains in the memory during the c) new file
entire computer session d) none of the mentioned
Answer: c Answer: a
Explanation: None. Explanation: None.
28. Which one of the following error will be 32. Which facility dynamically adds probes
handle by the operating system? to a running system, both in user processes
a) power failure and in the kernel?
b) lack of paper in printer a) DTrace
c) connection failure in the network b) DLocate
d) all of the mentioned c) DMap
d) DAdd
Answer: d
Explanation: None. Answer: a
Explanation: None.
29. What is the main function of the
command interpreter? 33. Which one of the following is not a real
a) to get and execute the next user- time operating system?
specified command a) VxWorks
b) to provide the interface between the API b) Windows CE
and application program
6 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
c) RTLinux an error
d) Palm OS b) software generated interrupt caused by
an error
Answer: d
c) user generated interrupt caused by an
Explanation: None.
error
34. The OS X has ____________ d) none of the mentioned
a) monolithic kernel
Answer: b
b) hybrid kernel
Explanation: None.
c) microkernel
d) monolithic kernel with modules 38. What is an ISR?
a) Information Service Request
Answer: b
b) Interrupt Service Request
Explanation: None.
c) Interrupt Service Routine
35. The initial program that is run when the d) Information Service Routine
computer is powered up is called
Answer: c
__________
Explanation: None.
a) boot program
b) bootloader 39. What is an interrupt vector?
c) initializer a) It is an address that is indexed to an
d) bootstrap program interrupt handler
b) It is a unique device number that is
Answer: d
indexed by an address
Explanation: None.
c) It is a unique identity given to an
36. How does the software trigger an interrupt
interrupt? d) None of the mentioned
a) Sending signals to CPU through bus
Answer: a
b) Executing a special operation called
Explanation: None.
system call
c) Executing a special program called 40. The systems which allow only one
system program process execution at a time, are called
d) Executing a special program called __________
interrupt trigger program a) uniprogramming systems
b) uniprocessing systems
Answer: b
c) unitasking systems
Explanation: None.
d) none of the mentioned
37. What is a trap/exception?
Answer: b
a) hardware generated interrupt caused by
Explanation: Those systems which allows
more than one process execution at a time, c) when process is using the CPU
are called multiprogramming systems. d) none of the mentioned
Uniprocessing means only one processor.
Answer: a
41. In operating system, each process has Explanation: When process is unable to run
its own __________ until some task has been completed, the
a) address space and global variables process is in blocked state and if process is
b) open files using the CPU, it is in running state.
c) pending alarms, signals and signal
45. What is interprocess communication?
handlers
a) communication within the process
d) all of the mentioned
b) communication between two process
Answer: d c) communication between two threads of
Explanation: None. same process
d) none of the mentioned
42. In Unix, Which system call creates the
new process? Answer: b
a) fork Explanation: None.
b) create
46. A set of processes is deadlock if
c) new
__________
d) none of the mentioned
a) each process is blocked and will remain
Answer: a so forever
Explanation: None. b) each process is terminated
c) all processes are trying to kill each other
43. A process can be terminated due to
d) none of the mentioned
__________
a) normal exit Answer: a
b) fatal error Explanation: None.
c) killed by another process
47. A process stack does not contain
d) all of the mentioned
__________
Answer: d a) Function parameters
Explanation: None. b) Local variables
c) Return addresses
44. What is the ready state of a process?
d) PID of child process
a) when process is scheduled to run after
some execution Answer: d
b) when process is unable to run until some Explanation: None.
task has been completed
48. Which system call returns the process 52. What will happen when a process
identifier of a terminated child? terminates?
a) wait a) It is removed from all queues
b) exit b) It is removed from all, but the job queue
c) fork c) Its process control block is de-allocated
d) get d) Its process control block is never de-
allocated
Answer: a
Explanation: None. Answer: a
Explanation: None.
49. The address of the next instruction to
be executed by the current process is 53. Which process can be affected by other
provided by the __________ processes executing in the system?
a) CPU registers a) cooperating process
b) Program counter b) child process
c) Process stack c) parent process
d) Pipe d) init process
Answer: b Answer: a
Explanation: None. Explanation: None.
50. Which of the following do not belong to 54. When several processes access the
queues for processes? same data concurrently and the outcome of
a) Job Queue the execution depends on the particular
b) PCB queue order in which the access takes place, is
c) Device Queue called?
d) Ready Queue a) dynamic condition
b) race condition
Answer: b
c) essential condition
Explanation: None.
d) critical condition
51. When the process issues an I/O request
Answer: b
__________
Explanation: None.
a) It is placed in an I/O queue
b) It is placed in a waiting queue 55. If a process is executing in its critical
c) It is placed in the ready queue section, then no other processes can be
d) It is placed in the Job queue executing in their critical section. This
condition is called?
Answer: a
a) mutual exclusion
Explanation: None.
b) critical exclusion
Answer: c Answer: c
Explanation: None. Explanation: None.
65. The link between two processes P and Q 68. In the non blocking send __________
to send and receive messages is called a) the sending process keeps sending until
__________ the message is received
a) communication link b) the sending process sends the message
b) message-passing link and resumes operation
c) synchronization link c) the sending process keeps sending until it
d) all of the mentioned receives a message
d) none of the mentioned
Answer: a
Explanation: None. Answer: b
Explanation: None.
66. Which of the following are TRUE for
direct communication? 69. In the Zero capacity queue __________
a) A communication link can be associated a) the queue can store at least one message
with N number of process(N = max. number b) the sender blocks until the receiver
of processes supported by system) receives the message
c) the sender keeps sending and the
11 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
messages don’t wait in the queue 73. The interval from the time of
d) none of the mentioned submission of a process to the time of
completion is termed as ____________
Answer: b
a) waiting time
Explanation: None.
b) turnaround time
70. The Zero Capacity queue __________ c) response time
a) is referred to as a message system with d) throughput
buffering
Answer: b
b) is referred to as a message system with
Explanation: None.
no buffering
c) is referred to as a link 74. Which scheduling algorithm allocates
d) none of the mentioned the CPU first to the process that requests
the CPU first?
Answer: b
a) first-come, first-served scheduling
Explanation: None.
b) shortest job scheduling
71. Which module gives control of the CPU c) priority scheduling
to the process selected by the short-term d) none of the mentioned
scheduler?
Answer: a
a) dispatcher
Explanation: None.
b) interrupt
c) scheduler 75. In priority scheduling algorithm
d) none of the mentioned ____________
a) CPU is allocated to the process with
Answer: a
highest priority
Explanation: None.
b) CPU is allocated to the process with
72. The processes that are residing in main lowest priority
memory and are ready and waiting to c) Equal priority processes can not be
execute are kept on a list called scheduled
_____________ d) None of the mentioned
a) job queue
Answer: a
b) ready queue
Explanation: None.
c) execution queue
d) process queue 76. In priority scheduling algorithm, when a
process arrives at the ready queue, its
Answer: b
priority is compared with the priority of
Explanation: None.
____________
a) all process
b) currently running process
12 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
Answer: b Answer: a
Explanation: None. Explanation: None.
77. Which algorithm is defined in Time 81. What are the two steps of a process
quantum? execution?
a) shortest job scheduling algorithm a) I/O & OS Burst
b) round robin scheduling algorithm b) CPU & I/O Burst
c) priority scheduling algorithm c) Memory & I/O Burst
d) multilevel queue scheduling algorithm d) OS & Memory Burst
Answer: b Answer: b
Explanation: None. Explanation: None.
78. Process are classified into different 82. An I/O bound program will typically
groups in ____________ have ____________
a) shortest job scheduling algorithm a) a few very short CPU bursts
b) round robin scheduling algorithm b) many very short I/O bursts
c) priority scheduling algorithm c) many very short CPU bursts
d) multilevel queue scheduling algorithm d) a few very short I/O bursts
Answer: d Answer: c
Explanation: None. Explanation: None.
79. CPU scheduling is the basis of 83. A process is selected from the ______
___________ queue by the ________ scheduler, to be
a) multiprocessor systems executed.
b) multiprogramming operating systems a) blocked, short term
c) larger memory sized systems b) wait, long term
d) none of the mentioned c) ready, short term
d) ready, long term
Answer: b
Explanation: None. Answer: c
Explanation: None.
80. With multiprogramming ______ is used
productively. 84. Round robin scheduling falls under the
a) time category of ____________
b) space a) Non-preemptive scheduling
b) Preemptive scheduling
Answer: b Answer: a
Explanation: None. Explanation: Large computers are
overloaded with a greater number of
85. With round robin scheduling algorithm
processes.
in a time shared system ____________
a) using very large time slices converts it 88. What is FIFO algorithm?
into First come First served scheduling a) first executes the job that came in last in
algorithm the queue
b) using very small time slices converts it b) first executes the job that came in first in
into First come First served scheduling the queue
algorithm c) first executes the job that needs minimal
c) using extremely small time slices processor
increases performance d) first executes the job that has maximum
d) using very small time slices converts it processor needs
into Shortest Job First algorithm
Answer: b
Answer: a Explanation: None.
Explanation: All the processes will be able
89. The strategy of making processes that
to get completed.
are logically runnable to be temporarily
86. The portion of the process scheduler in suspended is called ____________
an operating system that dispatches a) Non preemptive scheduling
processes is concerned with ____________ b) Preemptive scheduling
a) assigning ready processes to CPU c) Shortest job first
b) assigning ready processes to waiting d) First come First served
queue
Answer: b
c) assigning running processes to blocked
Explanation: None.
queue
d) all of the mentioned 90. What is Scheduling?
a) allowing a job to use the processor
Answer: a
b) making proper use of processor
Explanation: None.
c) all of the mentioned
87. Complex scheduling algorithms d) none of the mentioned
____________
Answer: a
a) are very appropriate for very large
Explanation: None.
computers
b) use minimal resources
14 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
P2 8
Answer: a Answer: c
Explanation: None. Explanation: None.
105. A minimum of _____ variable(s) is/are 109. What are the two atomic operations
required to be shared between processes to permissible on semaphores?
solve the critical section problem. a) wait
a) one b) stop
b) two c) hold
c) three d) none of the mentioned
d) four
Answer: a
Answer: b Explanation: None.
Explanation: None.
110. What are Spinlocks?
106. An un-interruptible unit is known as a) CPU cycles wasting locks over critical
____________ sections of programs
a) single b) Locks that avoid time wastage in context
b) atomic switches
c) static c) Locks that work better on multiprocessor
d) none of the mentioned systems
d) All of the mentioned
Answer: b
Explanation: None. Answer: d
Explanation: None.
107. TestAndSet instruction is executed
____________ 111. What is the main disadvantage of
a) after a particular process spinlocks?
b) periodically a) they are not sufficient for many process
c) atomically b) they require busy waiting
d) none of the mentioned c) they are unreliable sometimes
d) they are too complex for programmers
Answer: c
Explanation: None. Answer: b
Explanation: None.
108. Semaphore is a/an _______ to solve
the critical section problem.
c) all deadlocked processes must be 137. For a deadlock to arise, which of the
aborted following conditions must hold
d) inversion technique can be used simultaneously?
a) Mutual exclusion
Answer: a
b) No preemption
Explanation: None.
c) Hold and wait
134. The number of resources requested by d) All of the mentioned
a process ____________
Answer: d
a) must always be less than the total
Explanation: None.
number of resources available in the system
b) must always be equal to the total 138. For Mutual exclusion to prevail in the
number of resources available in the system system ____________
c) must not exceed the total number of a) at least one resource must be held in a
resources available in the system non sharable mode
d) must exceed the total number of b) the processor must be a uniprocessor
resources available in the system rather than a multiprocessor
c) there must be at least one resource in a
Answer: c
sharable mode
Explanation: None.
d) all of the mentioned
135. The request and release of resources
Answer: a
are ___________
Explanation: If another process requests
a) command line statements
that resource (non – shareable resource),
b) interrupts
the requesting process must be delayed
c) system calls
until the resource has been released.
d) special programs
139. For a Hold and wait condition to
Answer: c
prevail ____________
Explanation: None.
a) A process must be not be holding a
136. What are Multithreaded programs? resource, but waiting for one to be freed,
a) lesser prone to deadlocks and then request to acquire it
b) more prone to deadlocks b) A process must be holding at least one
c) not at all prone to deadlocks resource and waiting to acquire additional
d) none of the mentioned resources that are being held by other
processes
Answer: b c) A process must hold at least one resource
Explanation: Multiple threads can compete and not be waiting to acquire additional
for shared resources. resources
d) None of the mentioned
being checked against the relocation and 179. If relocation is static and is done at
limit registers assembly or load time, compaction
_________
Answer: d
a) cannot be done
Explanation: None.
b) must be done
176. In internal fragmentation, memory is c) must not be done
internal to a partition and ____________ d) can be done
a) is being used
Answer: a
b) is not being used
Explanation: None.
c) is always used
d) none of the mentioned 180. The disadvantage of moving all process
to one end of memory and all holes to the
Answer: b
other direction, producing one large hole of
Explanation: None.
available memory is ____________
177. A solution to the problem of external a) the cost incurred
fragmentation is ____________ b) the memory used
a) compaction c) the CPU used
b) larger memory space d) all of the mentioned
c) smaller memory space
Answer: a
d) none of the mentioned
Explanation: None.
Answer: a
181. __________ is generally faster than
Explanation: None.
_________ and _________
178. Another solution to the problem of a) first fit, best fit, worst fit
external fragmentation problem is to b) best fit, first fit, worst fit
____________ c) worst fit, best fit, first fit
a) permit the logical address space of a d) none of the mentioned
process to be noncontiguous
Answer: a
b) permit smaller processes to be allocated
Explanation: None.
memory at last
c) permit larger processes to be allocated 182. Physical memory is broken into fixed-
memory at last sized blocks called ________
d) all of the mentioned a) frames
b) pages
Answer: a
c) backing store
Explanation: None.
d) none of the mentioned
Answer: a Answer: c
Explanation: None. Explanation: None.
183. Logical memory is broken into blocks 187. The size of a page is typically
of the same size called _________ ____________
a) frames a) varied
b) pages b) power of 2
c) backing store c) power of 4
d) none of the mentioned d) none of the mentioned
Answer: b Answer: b
Explanation: None. Explanation: None.
184. Every address generated by the CPU is 188. Each entry in a translation lookaside
divided into two parts. They are buffer (TLB) consists of ____________
____________ a) key
a) frame bit & page number b) value
b) page number & page offset c) bit value
c) page offset & frame bit d) constant
d) frame offset & page offset
Answer: a
Answer: b Explanation: None.
Explanation: None.
189. If a page number is not found in the
185. The __________ is used as an index TLB, then it is known as a ____________
into the page table. a) TLB miss
a) frame bit b) Buffer miss
b) page number c) TLB hit
c) page offset d) All of the mentioned
d) frame offset
Answer: a
Answer: b Explanation: None.
Explanation: None.
190. An ______ uniquely identifies
186. The _____ table contains the base processes and is used to provide address
address of each page in physical memory. space protection for that process.
a) process a) address space locator
b) memory b) address space identifier
c) page c) address process identifier
d) frame d) none of the mentioned
b) starting physical address of the segment 202. The protection bit is 0/1 based on
in memory ____________
c) segment length a) write only
d) none of the mentioned b) read only
c) read – write
Answer: c
d) none of the mentioned
Explanation: None.
Answer: c
199. The offset ‘d’ of the logical address
Explanation: None.
must be ____________
a) greater than segment limit 203. If there are 32 segments, each of size
b) between 0 and segment limit 1Kb, then the logical address should have
c) between 0 and the segment number ____________
d) greater than the segment number a) 13 bits
b) 14 bits
Answer: b
c) 15 bits
Explanation: None.
d) 16 bits
200. If the offset is legal ____________
Answer: a
a) it is used as a physical memory address
Explanation: To specify a particular
itself
segment, 5 bits are required. To select a
b) it is subtracted from the segment base to
particular byte after selecting a page, 10
produce the physical memory address
more bits are required. Hence 15 bits are
c) it is added to the segment base to
required.
produce the physical memory address
d) none of the mentioned 204. If one or more devices use a common
set of wires to communicate with the
Answer: a
computer system, the connection is called
Explanation: None.
______
201. When the entries in the segment a) CPU
tables of two different processes point to b) Monitor
the same physical location ____________ c) Wirefull
a) the segments are invalid d) Bus
b) the processes get blocked
Answer: d
c) segments are shared
Explanation: None.
d) all of the mentioned
205. A ____ a set of wires and a rigidly
Answer: c
defined protocol that specifies a set of
Explanation: None.
messages that can be sent on the wires.
a) port
30 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
b) node Answer: a
c) bus Explanation: None.
d) none of the mentioned
209. An I/O port typically consists of four
Answer: c registers status, control, ________ and
Explanation: None. ________ registers.
a) system in, system out
206. When device A has a cable that plugs
b) data in, data out
into device B, and device B has a cable that
c) flow in, flow out
plugs into device C and device C plugs into a
d) input, output
port on the computer, this arrangement is
called a _________ Answer: b
a) port Explanation: None.
b) daisy chain
210. The ______ register is read by the host
c) bus
to get input.
d) cable
a) flow in
Answer: b b) flow out
Explanation: None. c) data in
d) data out
207. The _________ present a uniform
device-access interface to the I/O Answer: c
subsystem, much as system calls provide a Explanation: None.
standard interface between the application
211. The ______ register is written by the
and the operating system.
host to send output.
a) Devices
a) status
b) Buses
b) control
c) Device drivers
c) data in
d) I/O systems
d) data out
Answer: c
Answer: d
Explanation: None.
Explanation: None.
208. A ________ is a collection of
212. The hardware mechanism that allows a
electronics that can operate a port, a bus,
device to notify the CPU is called _______
or a device.
a) polling
a) controller
b) interrupt
b) driver
c) driver
c) host
d) controlling
d) bus
Answer: a a) errors
Explanation: None. b) exceptions
c) interrupt handlers
234. The ________ can be turned off by the
d) all of the mentioned
CPU before the execution of critical
instruction sequences that must not be Answer: b
interrupted. Explanation: None.
a) nonmaskable interrupt
238. For large data transfers, _________ is
b) blocked interrupt
used.
c) maskable interrupt
a) dma
d) none of the mentioned
b) programmed I/O
Answer: c c) controller register
Explanation: None. d) none of the mentioned
Answer: c Answer: b
Explanation: None. Explanation: None.
252. For most computers, the bootstrap is 256. The set of tracks that are at one arm
stored in ________ position make up a ___________
a) RAM a) magnetic disks
b) ROM b) electrical disks
c) Cache c) assemblies
d) Tertiary storage d) cylinders
Answer: b Answer: d
Explanation: None. Explanation: None.
253. A disk that has a boot partition is called 257. The time taken to move the disk arm
a _________ to the desired cylinder is called the
a) start disk ____________
b) end disk a) positioning time
c) boot disk b) random access time
d) all of the mentioned c) seek time
d) rotational latency
Answer: c
Explanation: None. Answer: c
Explanation: None.
254. In _______ information is recorded
magnetically on platters.
258. Whenever a process needs I/O to or Considering SSTF (shortest seek time first)
from a disk it issues a ______________ scheduling, the total number of head
a) system call to the CPU movements is, if the disk head is initially at
b) system call to the operating system 53 is?
c) a special procedure a) 224
d) all of the mentioned b) 236
c) 245
Answer: b
d) 240
Explanation: None.
Answer: b
259. If a process needs I/O to or from a disk,
Explanation: None.
and if the drive or controller is busy then
____________ 262. Random access in magnetic tapes is
a) the request will be placed in the queue of _________ compared to magnetic disks.
pending requests for that drive a) fast
b) the request will not be processed and will b) very fast
be ignored completely c) slow
c) the request will be not be placed d) very slow
d) none of the mentioned
Answer: d
Answer: a Explanation: None.
Explanation: None.
263. I/O hardware contains ____________
260. Consider a disk queue with requests a) Bus
for I/O to blocks on cylinders. b) Controller
98 183 37 122 14 124 65 67 c) I/O port and its registers
Considering FCFS (first cum first served) d) All of the mentioned
scheduling, the total number of head
Answer: d
movements is, if the disk head is initially at
Explanation: None.
53 is?
a) 600 264. The data-in register of I/O port is
b) 620 ____________
c) 630 a) Read by host to get input
d) 640 b) Read by controller to get input
c) Written by host to send output
Answer: d
d) Written by host to start a command
Explanation: None.
Answer: a
261. Consider a disk queue with requests
Explanation: None.
for I/O to blocks on cylinders.
98 183 37 122 14 124 65 67
38 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
c) the entire process will run 275. When is the Many to One model at an
d) none of the mentioned advantage?
a) When the program does not need
Answer: a
multithreading
Explanation: None.
b) When the program has to be multi-
273. In the Many to One model, multiple threaded
threads are unable to run in parallel on c) When there is a single processor
multiprocessors because of ___________ d) None of the mentioned
a) only one thread can access the kernel at
Answer: a
a time
Explanation: None.
b) many user threads have access to just
one kernel thread 276. In the Many to Many model true
c) there is only one kernel thread concurrency cannot be gained because
d) none of the mentioned ___________
a) the kernel can schedule only one thread
Answer: a
at a time
Explanation: None.
b) there are too many threads to handle
273. The One to One model allows c) it is hard to map threads with each other
___________ d) none of the mentioned
a) increased concurrency
Answer: a
b) decreased concurrency
Explanation: None.
c) increased or decreased concurrency
d) concurrency equivalent to other models 277. In the Many to Many models when a
thread performs a blocking system call
Answer: a
___________
Explanation: None.
a) other threads are strictly prohibited from
274. In the One to One model when a running
thread makes a blocking system call b) other threads are allowed to run
___________ c) other threads only from other processes
a) other threads are strictly prohibited from are allowed to run
running d) none of the mentioned
b) other threads are allowed to run
Answer: b
c) other threads only from other processes
Explanation: None.
are allowed to run
d) none of the mentioned 278. 1. Thread pools are useful when
____________
Answer: b a) when we need to limit the number of threads
Explanation: None. running in the application at the same time
286. What are routing strategies which is 290. If one site fails in distributed system
not used in distributed systems? then ___________
a) Fixed routing a) the remaining sites can continue
b) Token routing operating
c) Virtual circuit b) all the sites will stop working
d) Dynamic routing c) directly connected sites will stop working
d) none of the mentioned
Answer: c
Explanation: None. Answer: a
Explanation: None.
287. What are the connection strategies not
used in distributed systems? 291. Network operating system runs on
a) Circuit switching ___________
b) Message switching a) server
c) Token switching b) every system in the network
d) Packet switching c) both server and every system in the
network
Answer: c
d) none of the mentioned
Explanation: None.
Answer: a
288. How is are collisions avoided in
Explanation: None.
network?
a) Carrier sense with multiple access 292. Which technique is based on compile-
(CSMA); collision detection (CD) time program transformation for accessing
b) Carrier sense multiple access with remote data in a distributed-memory
collision avoidance parallel system?
c) Message slots a) cache coherence scheme
d) All of the mentioned b) computation migration
c) remote procedure call
Answer: d
d) message passing
Explanation: None.
Answer: b
289. In distributed system, each processor
Explanation: None.
has its own ___________
a) local memory 293. Logical extension of computation
b) clock migration is ___________
c) both local memory and clock a) process migration
d) none of the mentioned b) system migration
c) thread migration
Answer: c
d) data migration
Explanation: None.
Answer: a Answer: b
Explanation: None. Explanation: None.
294. Processes on the remote systems are 298. What are the characteristics of
identified by ___________ processor in distributed system?
a) host ID a) They vary in size and function
b) host name and identifier b) They are same in size and function
c) identifier c) They are manufactured with single
d) process ID purpose
d) They are real-time devices
Answer: b
Explanation: None. Answer: a
Explanation: None.
295. Which routing technique is used in a
distributed system? 299. What are the characteristics of a
a) fixed routing distributed file system?
b) virtual routing a) Its users, servers and storage devices are
c) dynamic routing dispersed
d) all of the mentioned b) Service activity is not carried out across
the network
Answer: d
c) They have single centralized data
Explanation: None.
repository
296. In distributed systems, link and site d) There are multiple dependent storage
failure is detected by ___________ devices
a) polling
Answer: a
b) handshaking
Explanation: None.
c) token passing
d) none of the mentioned 300. What is not a major reason for building
distributed systems?
Answer: b
a) Resource sharing
Explanation: None.
b) Computation speedup
297. What is not true about a distributed c) Reliability
system? d) Simplicity
a) It is a collection of processor
Answer: d
b) All processors are synchronized
Explanation: None.
c) They do not share memory
d) None of the mentioned 301. What are the types of distributed
operating system?
a) Network Operating system
Answer: d Answer: a
Explanation: None. Explanation: None.
317. Which is not a major component of a 321. What are characteristic of NFS
file system? protocol?
a) Directory service a) Search for file within directory
b) Authorization service b) Read a set of directory entries
c) Shadow service c) Manipulate links and directories
d) System service d) All of the mentioned
Answer: c Answer: d
Explanation: None. Explanation: None.
318. What are the different ways mounting 322. The file once created can not be
of the file system? changed is called ___________
a) boot mounting a) immutable file
b) auto mounting b) mutex file
c) explicit mounting c) mutable file
d) all of the mentioned d) none of the mentioned
Answer: d Answer: a
Explanation: None. Explanation: None.
319. Implementation of a stateless file 323. ______ of the distributed file system
server must not follow? are dispersed among various machines of
a) Idempotency requirement distributed system.
b) Encryption of keys a) Clients
c) File locking mechanism b) Servers
d) Cache consistency c) Storage devices
d) All of the mentioned
Answer: b
Explanation: None. Answer: d
Explanation: None.
320. What are the advantages of file
replication? 324. _______ is not possible in distributed
a) Improves availability & performance file system.
b) Decreases performance a) File replication
c) They are consistent b) Migration
d) Improves speed c) Client interface
d) Remote access
332. A heavy weight process ___________ c) reduce the address space that a process
a) has multiple threads of execution could potentially use
b) has a single thread of execution d) all of the mentioned
c) can have multiple or a single thread for
Answer: d
execution
Explanation: None.
d) none of the mentioned
336. Multithreading on a multi – CPU
Answer: b
machine ___________
Explanation: None.
a) decreases concurrency
333. A process having multiple threads of b) increases concurrency
control implies ___________ c) doesn’t affect the concurrency
a) it can do more than one task at a time d) can increase or decrease the concurrency
b) it can do only one task at a time, but
Answer: b
much faster
Explanation: None.
c) it has to use only one thread per process
d) none of the mentioned 337. The kernel is _______ of user threads.
a) a part of
Answer: a
b) the creator of
Explanation: None.
c) unaware of
334. Multithreading an interactive program d) aware of
will increase responsiveness to the user by
Answer: c
___________
Explanation: None.
a) continuing to run even if a part of it is
blocked 338. ______ is a unique tag, usually a
b) waiting for one part to finish before the number identifies the file within the file
other begins system.
c) asking the user to decide the order of a) File identifier
multithreading b) File name
d) none of the mentioned c) File type
d) None of the mentioned
Answer: a
Explanation: None. Answer: a
Explanation: None.
335. Resource sharing helps ___________
a) share the memory and resources of the 339. To create a file ____________
process to which the threads belong a) allocate the space in file system
b) an application have several different b) make an entry for new file in directory
threads of activity all within the same c) allocate the space in file system & make
address space
48 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
b) only if he accesses the system with a translations for the entire internet
guest account c) binary to hex translations for the entire
c) only if he has an account on the remote internet
system d) all of the mentioned
d) none of the mentioned
Answer: a
Answer: a Explanation: None.
Explanation: The world wide web uses
358. Reliability of files can be increased by
anonymous file exchange almost
_____________
exclusively.
a) keeping the files safely in the memory
355. The machine containing the files is the b) making a different partition for the files
_______ and the machine wanting to access c) by keeping them in external storage
the files is the ______ d) by keeping duplicate copies of the file
a) master, slave
Answer: d
b) memory, user
Explanation: None.
c) server, client
d) none of the mentioned 359. Protection is only provided at the
_____ level.
Answer: c
a) lower
Explanation: None.
b) central
356. Distributed naming c) higher
services/Distributed information systems d) none of the mentioned
have been devised to _____________
Answer: a
a) provide information about all the
Explanation: None.
systems
b) provide unified access to the information 360. What is the main problem with access
needed for remote computing control lists?
c) provide unique names to all systems in a a) their maintenance
network b) their length
d) all of the mentioned c) their permissions
d) all of the mentioned
Answer: b
Explanation: None. Answer: b
Explanation: None.
357. Domain name system provides
_____________ 361. Many systems recognize three
a) host-name-to-network-address classifications of users in connection with
translations for the entire internet each file (to condense the access control
b) network-address-to-host-name
51 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
list). Answer: b
a) Owner Explanation: None.
b) Group
365. In indexed allocation _____________
c) Universe
a) each file must occupy a set of contiguous
d) All of the mentioned
blocks on the disk
Answer: d b) each file is a linked list of disk blocks
Explanation: None. c) all the pointers to scattered blocks are
placed together in one location
362. The three major methods of allocating
d) none of the mentioned
disk space that are in wide use are
_____________ Answer: c
a) contiguous Explanation: None.
b) linked
366. On systems where there are multiple
c) indexed
operating system, the decision to load a
d) all of the mentioned
particular one is done by _____________
Answer: d a) boot loader
Explanation: None. b) bootstrap
c) process control block
363. In contiguous allocation
d) file control block
_____________
a) each file must occupy a set of contiguous Answer: a
blocks on the disk Explanation: None.
b) each file is a linked list of disk blocks
367. The VFS (virtual file system) activates
c) all the pointers to scattered blocks are
file system specific operations to handle
placed together in one location
local requests according to their _______
d) none of the mentioned
a) size
Answer: a b) commands
Explanation: None. c) timings
d) file system types
364. In linked allocation _____________
a) each file must occupy a set of contiguous Answer: d
blocks on the disk Explanation: None.
b) each file is a linked list of disk blocks
368. A device driver can be thought of like a
c) all the pointers to scattered blocks are
translator. Its input consists of _____
placed together in one location
commands and output consists of _______
d) none of the mentioned
instructions.
a) high level, low level
b) low level, high level 372. For processes to request access to file
c) complex, simple contents, they need _____________
d) low level, complex a) to run a seperate program
b) special interrupts
Answer: a
c) to implement the open and close system
Explanation: None.
calls
369. The file organization module knows d) none of the mentioned
about _____________
Answer: c
a) files
Explanation: None.
b) logical blocks of files
c) physical blocks of files 373. A better way of contiguous allocation
d) all of the mentioned to extend the file size is _____________
a) adding an extent (another chunk of
Answer: d
contiguous space)
Explanation: None.
b) adding an index table to the first
370. Metadata includes _____________ contiguous block
a) all of the file system structure c) adding pointers into the first contiguous
b) contents of files block
c) both file system structure and contents d) none of the mentioned
of files
Answer: a
d) none of the mentioned
Explanation: None.
Answer: c
374. If the extents are too large, then what
Explanation: None.
is the problem that comes in?
371. For each file there exists a a) internal fragmentation
___________ that contains information b) external fragmentation
about the file, including ownership, c) starvation
permissions and location of the file d) all of the mentioned
contents.
Answer: a
a) metadata
Explanation: None.
b) file control block
c) process control block 375. The FAT is used much as a _________
d) all of the mentioned a) stack
b) linked list
Answer: b
c) data
Explanation: None.
d) pointer
Answer: b Answer: a
Explanation: None. Explanation: None.
c) it is redone ____________
d) none of the mentioned a) Compile time
b) Load time
Answer: b
c) Execution time
Explanation: None.
d) All of the mentioned
384. A machine in Network file system (NFS)
Answer: d
can be ________
Explanation: None.
a) client
b) server Explanation: None.
c) both client and server
388. Which one of the following is a process
d) neither client nor server
that uses the spawn mechanism to revage
Answer: c the system performance?
Explanation: None. a) worm
b) trojan
385. A _________ directory is mounted
c) threat
over a directory of a _______ file system.
d) virus
a) local, remote
b) remote, local Answer: a
c) local, local Explanation: None.
d) none of the mentioned
389. What is true regarding ‘Fence’?
Answer: d a) Its a method to confine users to one side
Explanation: None. of a boundary
b) It can protect Operating system from one
386. What is Address Binding?
user
a) going to an address in memory
c) It cannot protect users from each other
b) locating an address with the help of
d) All of the mentioned
another address
c) binding two addresses together to form a Answer: d
new address in a different memory space Explanation: None.
d) a mapping from one address space to
390. What is not true regarding ‘Fence’?
another
a) It is implemented via hardware register
View Answer
b) It doesn’t protect users from each other
Answer: d c) It good to protect OS from abusive users
Explanation: None. d) Its implementation is unrestricted and
can take any amount of space in Operating
387. Binding of instructions and data to
system.
memory addresses can be done at
d) Give both read and write permission but 401. Which mechanism is used by worm
not execute process?
a) Trap door
Answer: c
b) Fake process
Explanation: Limited access is a key method
c) Spawn Process
to circumvent unauthorized access and
d) VAX process
exploits.
Answer: c
398. What is breach of availability?
Explanation: None.
a) This type of violation involves
unauthorized reading of data 402. Which of the following is not a
b) This violation involves unauthorized characteristic of a virus?
modification of data a) Virus destroy and modify user data
c) This violation involves unauthorized b) Virus is a standalone program
destruction of data c) Virus is a code embedded in a legitimate
d) This violation involves unauthorized use program
of resources d) Virus cannot be detected
Answer: c Answer: d
Explanation: None. Explanation: Virus can be detected by
having an antivirus program.
399. What is Trojan horse?
a) It is a useful way to encrypt password 403. What is not an important part of
b) It is a user which steals valuable security protection?
information a) Large amount of RAM to support
c) It is a rogue program which tricks users antivirus
d) It’s a brute force attack algorithm b) Strong passwords
c) Audit log periodically
Answer: c
d) Scan for unauthorized programs in
Explanation: None.
system directories
400. What is trap door?
Answer: a
a) IT is trap door in WarGames
Explanation: RAM has no effect on security
b) It is a hole in software left by designer
of a system. System’s protection remains
c) It is a Trojan horse
unchanged in increasing or decreasing
d) It is a virus which traps and locks user
amount of RAM.
terminal
404. What is used to protect network from
Answer: b
outside internet access?
Explanation: None.
a) A trusted antivirus
b) 24 hours scanning for virus
57 DIWAKAR EDUCATION HUB
System Software and Operating System Unit – 5 MCQs
c) 3 multiple processes
d) 4 b) for tasks where absolute priorities are
more important than fairness
Answer: d
c) all of the mentioned
Explanation: None.
d) none of the mentioned
411. A performance problem with
Answer: a
_________ is the expense of computing and
Explanation: None.
writing parity.
a) non-parity based RAID levels 415. The first linux kernel which supports
b) parity based RAID levels the SMP hardware?
c) all RAID levels a) linux 0.1
d) none of the mentioned b) linux 1.0
c) linux 1.2
Answer: b
d) linux 2.0
Explanation: None.
Answer: d
412. In RAID level 4, one block read,
Explanation: None.
accesses __________
a) only one disk 416. What is Linux?
b) all disks simultaneously a) single user, single tasking
c) all disks sequentially b) single user, multitasking
d) none of the mentioned c) multi user, single tasking
d) multi user, multitasking
Answer: a
Explanation: Other requests are allowed to Answer: d
be processed by other disks. Explanation: None.
413. The overall I/O rate in RAID level 4 is 417. Which one of the following is not a
____________ linux distribution?
a) low a) debian
b) very low b) gentoo
c) high c) open SUSE
d) none of the mentioned d) multics
Answer: c Answer: d
Explanation: All disks can be read in parallel. Explanation: None.
414. Linux uses a time-sharing algorithm 418. In distributed systems, a logical clock is
___________ associated with ______________
a) to pair preemptive scheduling between a) each instruction
Answer: a
Explanation: None.
Answer: b
Explanation: None.
Answer: c
Explanation: None.