OSY Unit 1 Notes by Campusify
OSY Unit 1 Notes by Campusify
1 Overview of OS
Chapter 1 Marks 10
On the other hand, system software is more transparent and less noticed by the typical
computer user. This software provides a general programming environment in which
programmers can create specific applications to suit their needs. This environment provides
new functions that are not available at the hardware level and performs tasks related to
executing the application program. System software acts as an interface between the
hardware of the computer and the application software that users need to run on the
computer. The most important type of system software is the operating system.
Operating Systems are viewed as resource managers. The main resource is the computer
hardware in the form of processors, storage, input/output devices, communication devices,
and data. Some of the operating system functions are: implementing the user interface,
sharing hardware among users, allowing users to share data among themselves, preventing
users from interfering with one another, scheduling resources among users, facilitating
input/output, recovering from errors, accounting for resource usage, facilitating parallel
operations, organizing data for secure and rapid access, and handling network
communications.
We can also view a computer system as consisting of hardware, software, and data. The
operating system provides the means for proper use of these resources in the operation of
the computer system. An operating system is similar to a government. Like a government, it
performs no useful function by itself. It simply provides an environment within which other
programs can do useful work.
To understand more fully the operating system’s role, we next explore operating systems
from two viewpoints: that of the user and that of the system.
A slightly different view of an operating system emphasizes the need to control the various
I/O devices and user programs. An operating system is a control program. A control
program manages the execution of user programs to prevent errors and improper use of
the computer. It is especially concerned with the operation and control of I/O devices.
Once the kernel is loaded and executing, it can start providing services to the system and its
users. Some services are provided outside of the kernel, by system programs that are loaded
into memory at boot time to become system processes, or system daemons that run the
entire time the kernel is running.
The occurrence of an event is usually signaled by an interrupt from either the hardware or
the software. Hardware may trigger an interrupt at any time by sending a signal to the CPU,
usually by way of the system bus. Software may trigger an interrupt by executing a special
operation called a system call (also called a monitor call).
Computers use other forms of memory as well. We have already mentioned read-only
memory, ROM) and electrically erasable programmable read-only memory, EEPROM).
Because ROM cannot be changed, only static programs, such as the bootstrap program
described earlier, are stored there. The immutability of ROM is of use in game cartridges.
EEPROM can be changed but cannot be changed frequently and so contains mostly static
programs. For example, smartphones have EEPROM to store their factory-installed
programs.
Ideally, we want the programs and data to reside in main memory permanently. This
arrangement usually is not possible for the following two reasons:
1. Main memory is usually too small to store all needed programs and data permanently.
2. Main memory is a volatile storage device that loses its contents when power is turned off
or otherwise lost.
Thus, most computer systems provide secondary storage as an extension of main memory.
The main requirement for secondary storage is that it be able to hold large quantities of
data permanently.
The most common secondary-storage device is a magnetic disk, which provides storage for
both programs and data. Most programs (system and application) are stored on a disk until
they are loaded into memory. Many programs then use the disk as both the source and the
destination of their processing. Hence, the proper management of disk storage is of central
importance to a computer system,
1.8 FUNCTIONS OF OS
The main functions of an operating system are as follows:
1. Process Management
2. Memory Management
3. Secondary Storage Management
4. I/O Management
5. File Management
6. Protection
7. Networking Management
8. Command Interpretation.
For convenient use of the computer system, the operating system provides a uniform logical
view of information storage. The operating system abstracts from the physical properties of
its storage devices to define a logical storage unit, the file. Files are mapped, by the
operating system, onto physical devices.
A file is a collection of related information defined by its creator. Commonly, files represent
programs (both source and object forms) and data. Data files may be numeric, alphabetic or
alphanumeric. Files may be free-form, such as text files, or may be rigidly formatted. In
general a file is a sequence of bits, bytes, lines or records whose meaning is defined by its
creator and user. It is a very general concept.
The operating system implements the abstract concept of the file by managing mass storage
device, such as types and disks. Also files are normally organized into directories to ease
their use. Finally, when multiple users have access to files, it may be desirable to control by
whom and in what ways files may be accessed.
The operating system is responsible for the following activities in connection to the file
management:
1. The creation and deletion of files.
2. The creation and deletion of directory.
3. The support of primitives for manipulating files and directories.
4. The mapping of files onto disk storage.
5. Backup of files on stable (non volatile) storage.
1.8.6 Protection
The various processes in an operating system must be protected from each other’s activities.
For that purpose, various mechanisms which can be used to ensure that the files, memory
segment, CPU and other resources can be operated on only by those processes that have
gained proper authorization from the operating system.
For example, memory addressing hardware ensures that a process can only execute within
its own address space. The timer ensures that no process can gain control of the CPU
without relinquishing it. Finally, no process is allowed to do its own I/O, to protect the
integrity of the various peripheral devices. Protection refers to a mechanism for controlling
the access of programs, processes, or users to the resources defined by a computer controls
to be imposed, together with some means of enforcement.
Protection can improve reliability by detecting latent errors at the interfaces between
component subsystems. Early detection of interface errors can often prevent contamination
of a healthy subsystem by a subsystem that is malfunctioning. An unprotected resource
cannot defend against use (or misuse) by an unauthorized or incompetent user.
1.8.7 Networking
A distributed system is a collection of processors that do not share memory or a clock.
Instead, each processor has its own local memory, and the processors communicate with
each other through various communication lines, such as high speed buses or telephone
lines. Distributed systems vary in size and function. They may involve microprocessors,
workstations, minicomputers, and large general purpose computer systems.
The processors in the system are connected through a communication network, which can
be configured in the number of different ways. The network may be fully or partially
connected. The communication network design must consider routing and connection
strategies and the problems of connection and security.
A distributed system provides the user with access to the various resources the system
maintains. Access to a shared resource allows computation speed-up, data availability, and
reliability.
The command statements themselves deal with process management, I/O handling,
secondary storage management, main memory management, file system access, protection,
and networking.
Figure depicts the role of the operating system in coordinating all the functions.
An Operating System performs all the basic tasks like managing file, process, and memory.
Thus operating system acts as manager of all the resources, i.e. resource manager. Thus
operating system becomes an interface between user and machine.
Types of Operating Systems: Some of the widely used operating systems are as follows-
1. Batch OS –
This type of operating system does not interact with the computer directly. The user has to
submit a job (written on cards or tape) to a computer operator. There is an operator which
takes similar jobs having same requirement and group them into batches. It is the
responsibility of operator to sort the jobs with similar needs. Then computer operator
places a batch of several jobs on an input device. Jobs are batched together by type of
languages and requirement. Then a special program, the monitor, manages the execution of
each program in the batch. The monitor is always in the main memory and available for
execution.
2. Multi programming –
In a modern computing system, there are usually several concurrent application processes
which want to execute. Now it is the responsibility of the Operating System to manage all
the processes effectively and efficiently.
One of the most important aspects of an Operating System is to multi program.
In a computer system, there are multiple processes waiting to be executed, i.e. they are
waiting when the CPU will be allocated to them and they begin their execution. These
processes are also known as jobs. Now the main memory is too small to accommodate all of
these processes or jobs into it. Thus, these processes are initially kept in an area called job
pool. This job pool consists of all those processes awaiting allocation of main memory and
CPU.
CPU selects one job out of all these waiting jobs, brings it from the job pool to main memory
and starts executing it. The processor executes one job until it is interrupted by some
external factor or it goes for an I/O task.
Non-multi programmed system’s working –
In a non multi programmed system, As soon as one job leaves the CPU and goes for
some other task (say I/O ), the CPU becomes idle. The CPU keeps waiting and waiting
until this job (which was executing earlier) comes back and resumes its execution with
the CPU. So CPU remains free for all this while.
Now it has a drawback that the CPU remains idle for a very long period of time. Also,
other jobs which are waiting to be executed might not get a chance to execute because
the CPU is still allocated to the earlier job.
This poses a very serious problem that even though other jobs are ready to execute,
CPU is not allocated to them as the CPU is allocated to a job which is not even utilizing
it (as it is busy in I/O tasks).
It cannot happen that one job is using the CPU for say 1 hour while the others have
been waiting in the queue for 5 hours. To avoid situations like this and come up with
efficient utilization of CPU, the concept of multi programming came up.
3. Multitasking –
As the name itself suggests, multi tasking refers to execution of multiple tasks (say
processes, programs, threads etc.) at a time. In the modern operating systems, we are able
to play MP3 music, edit documents in Microsoft Word, surf the Google Chrome all
simultaneously, this is accomplished by means of multi tasking.
Multitasking is a logical extension of multi programming. The major way in which
multitasking differs from multi programming is that multi programming works solely on the
concept of context switching whereas multitasking is based on time sharing alongside the
concept of context switching.
As depicted in the above image, At any time the CPU is executing only one task while
other tasks are waiting for their turn. The illusion of parallelism is achieved when the
CPU is reassigned to another task. i.e all the three tasks A, B and C are appearing to
occur simultaneously because of time sharing.
So for multitasking to take place, firstly there should be multiprogramming i.e.
presence of multiple programs ready for execution. And secondly the concept of time
sharing.
4. Multiprocessing –
In a uni-processor system, only one process executes at a time.
Multiprocessing is the use of two or more CPUs (processors) within a single Computer
system. The term also refers to the ability of a system to support more than one processor
Downloaded From Campusify!
12 OSY (22516)
CH.1 Overview of OS
within a single computer system. Now since there are multiple processors available,
multiple processes can be executed at a time. These multi processors share the computer
bus, sometimes the clock, memory and peripheral devices also.
Multi processing system’s working –
With the help of multiprocessing, many processes can be executed simultaneously. Say
processes P1, P2, P3 and P4 are waiting for execution. Now in a single processor
system, firstly one process will execute, then the other, then the other and so on.
But with multiprocessing, each process can be assigned to a different processor for its
execution. If its a dual-core processor (2 processors), two processes can be executed
simultaneously and thus will be two times faster, similarly a quad core processor will be
four times as fast as a single processor.
Why use multi processing –
The main advantage of multiprocessor system is to get more work done in a shorter
period of time. These types of systems are used when very high speed is required to
process a large volume of data. Multi processing systems can save money in
comparison to single processor systems because the processors can share peripherals
and power supplies.
It also provides increased reliability in the sense that if one processor fails, the work
does not halt, it only slows down. e.g. if we have 10 processors and 1 fails, then the
work does not halt, rather the remaining 9 processors can share the work of the 10th
processor. Thus the whole system runs only 10 percent slower, rather than failing
altogether.
Multiprocessing refers to the hardware (i.e., the CPU units) rather than the software (i.e.,
running processes). If the underlying hardware provides more than one processor then that
is multiprocessing. It is the ability of the system to leverage multiple processors’ computing
power.
Difference between Multi programming and Multi processing –
A System can be both multi programmed by having multiple programs running at the
same time and multiprocessing by having more than one physical processor. The
difference between multiprocessing and multi programming is that Multiprocessing is
Downloaded From Campusify!
13 OSY (22516)
CH.1 Overview of OS