OS Notes Chapter01
OS Notes Chapter01
CHAPTER 1: INTRODUCTION
Introduction to Operating System Types of OS
Objectives and Functions of O.S. System Calls, types of system calls
OS Services Operating system structure
System Boot
Special purpose systems
Thus, some operating systems are designed to be convenient, others to be efficient, and others
some combination of the two. Because an operating system is large and complex, it must be
created piece by piece. Each of these pieces should be a well-delineated portion of the system,
with carefully defined inputs, outputs, and functions.
1
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
A computer system can be divided roughly into four components: the hardware, the
operating system, the application programs and the users (Figure 1.1).
The hardware (the central processing unit), the memory, the input/output (I/O) devices
provide the basic computing resources for the system.
The application programs such as word processors/ spreadsheets/compilers, and Web
browsers define the ways in which these resources are used to solve users' computing
problems.
The operating system controls the hardware and coordinates its use among the various
application programs for the various users.
The users are people, machines, other computers etc.
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.
A. Efficiency
It allows computer to use resources efficiently.
Proper scheduling of resources.
Proper monitoring on these resources to avoid overhead.
Special attention to be given on CPU & memory.
B. Convenience
Makes computer user friendly.
Following factors are considered while considering user convenience:
1. Good service 2. Ease of use 3. New programming model 4. Evolution 5. User friendly
OS.
C. Ability to evolve
Constructed in a way to permit effective development, testing and introduction of
new functions without interfering with service.
3
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
User
Edito Loa
S t
Operating
4
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
ii. Space: Consider the example of main memory. Main memory is normally
divided up among several running programs, so each one can be resident at
the same time.
TYPES OF OS
Following are some of the most widely used types of Operating system.
In this type of system, there is no direct interaction between user and the computer.
The user has to submit a job (written on cards or tape) to a computer operator.
Then computer operator places a batch of several jobs on an input device.
Jobs are batched together by type of languages and requirement.
Then a special program, the monitor, manages the execution of each program in the
batch.
The monitor is always in the main memory and available for execution.
5
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
In this the operating system, picks and begins to execute one job from memory.
Once this job needs an I/O operation, operating system switches to another job (CPU and
OS always busy).
Jobs in the memory are always less than the number of jobs on disk (Job Pool).
If several jobs are ready to run at the same time, then system chooses which one to run
(CPU Scheduling).
In non-multiprogrammed system, there are moments when CPU sits idle and does not do
any work.
In Multiprogramming system, CPU will never be idle and keeps on processing.
Time-Sharing Systems are very similar to Multiprogramming batch systems. In fact, time
sharing systems are an extension of multiprogramming systems. In time sharing systems the
prime focus is on minimizing the response time, while in multiprogramming the prime focus is to
maximize the CPU usage.
3. Multiprocessor Systems
1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the system's
throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can be
executed in parallel in different processors. Thereby speeding up the execution of single
tasks.
6
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
These advancements in technology have made it possible to design and develop distributed
systems comprising of many computers that are inter connected by communication networks.
The main benefit of distributed systems is its low price/performance ratio.
It is defined as an operating system known to give maximum time for each of the critical
operations that it performs, like OS calls and interrupt handling.
The Operating system which guarantees the maximum time for these operations are commonly
referred to as hard real-time, while operating systems that can only guarantee a maximum of the
time are referred to as soft real-time.
Network Operating System runs on a server and provides server the capability to manage
data, users, groups, security, applications, and other networking functions. The primary purpose
of the network operating system is to allow shared file and printer access among multiple
computers in a network, typically a local area network (LAN), a private network or to other
networks. Examples of network operating systems are Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
7
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
A mobile operating system (or mobile OS) is an operating system for smartphones, tablets,
PDAs, or other mobile devices. Mobile operating system combines features of a personal
computer operating system with other features useful for mobile or handheld use; usually
including, and most of the following considered essential in modern mobile systems; a
touchscreen, cellular, Bluetooth, Wi-Fi, GPS mobile navigation, camera, video camera, speech
recognition, voice recorder, music player, near field communication and infrared blaster.
Symbian: Symbian OS is officially the property of Nokia. Still Symbian is widely used
in low-end phones but the demand rate has been continuously decreasing. By upgrading
Symbian mobile OS, Nokia has made it capable to run smartphones efficiently. Symbian
ANNA and BELLE are the two latest updates which are currently used in Nokia’s
smartphones. Overall, the Symbian OS is excellently designed and is very user-friendly.
Android: September 20th 2008 was the date when Google released the first Android OS
by the name of ‘Astro’. After some time, next upgraded versions ‘Bender’ and ‘Cupcake’
were also released. The other releases are Donut, Éclair, Froyo, Gingerbread,
Honeycomb, Ice Cream Sandwich and Jelly Bean. Jelly Bean is so far the latest android
version from google.
Apple iOS: iOS was introduced in 29th June 2007 when the first iPhone was developed.
Since then, iOS has been under gone many upgrades and currently the latest one is the
iOS 6. Apple has still not allowed any other manufacturer to lay hands on its operating
system. Unlike Android, Apple has more concentrated on the performance rather than
appearance. This is the reason that the basic appearance of iOS is almost the same as it
was in 2007. Overall, it is very user-friendly and is one of the best operating systems in
the world.
Blackberry OS: Blackberry OS is the property of RIM (Research in Motion) and was
first released in 1999. RIM has developed this operating system for its Blackberry line of
smartphones. Blackberry is much different from other operating systems. The interface
style as well as the smart phone design is also different having a trackball for moving on
the menu and a qwerty keyboard.
Windows OS: Windows OS has also been used in mobile phones but normal mobile
phone users find it a bit difficult to operate it but at the same time it was very popular
among people who were used to it.
8
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
Set 1 (services that are helpful to user): User interface, Program execution, I/O operations,
File-system manipulation, Communications, Error detection.
Set 2 (ensuring efficient operation of the system itself): Resource Allocation, Accounting,
Protection & Security.
One set of operating-system services provides functions that are helpful to the user.
- User interface. Almost all operating systems have a user interface (UI). This interface
can take several forms. One is a command-line interface (CLI), which uses text
commands and a method for entering them (say, a program to allow entering and editing
of commands). Another is a batch interface in which commands and directives to
control those commands are entered into files, and those files are executed. Most
commonly, a Graphical User Interface (GUI) is used. Here, the interface is a window
system with a pointing device to direct I/O, choose from menus, and make selections and
a keyboard to enter text. Some systems provide two or all three of these variations.
- Program execution. The system must be able to load a program into memory and to run
that program. The program must be able to end its execution, either normally or
abnormally (indicating error).
- I/O operations. A running program may require I/O, which may involve a file or an I/O
device. For specific devices, special functions may be desired (such as recording to a CD
or DVD drive or blanking a display screen). For efficiency and protection, users usually
cannot control I/O devices directly. Therefore, the operating system must provide a
means to do I/O.
- Error detection. The operating system needs to be constantly aware of possible errors.
Errors may occur in the CPU and memory hardware (such as a memory error or a power
failure), in I/O devices (such as a parity error on tape, a connection failure on a network,
or lack of paper in the printer), and in the user program (such as an arithmetic overflow,
9
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
an attempt to access an illegal memory location, or a too-great use of CPU time). For
each type of error, the operating system should take the appropriate action to ensure
correct and consistent computing. Of course, there is variation in how operating systems
react to and correct errors. Debugging facilities can greatly enhance the user's and
programmer's abilities to use the system efficiently.
Another set of operating-system functions exists not for helping the user but rather for
ensuring the efficient operation of the system itself. Systems with multiple users can gain
efficiency by sharing the computer resources among the users.
- Resource allocation. When there are multiple users or multiple jobs running at the same
time, resources must be allocated to each of them. Many different types of resources are
managed by the operating system. Some (such as CPU cycles, main memory, and file
storage) may have special allocation code, whereas others (such as I/O devices) may have
much more general request and release code. For instance, in determining how best to use
the CPU, operating systems have CPU-scheduling routines that take into account the
speed of the CPU, the jobs that must be executed, the number of registers available, and
other factors. There may also be routines to allocate printers, modems, USB storage
drives, and other peripheral devices.
- Accounting. We want to keep track of which users use how much and what kinds of
computer resources. This record keeping may be used for accounting (so that users can be
billed) or simply for accumulating usage statistics. Usage statistics may be a valuable tool
for researchers who wish to reconfigure the system to improve computing services.
10
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
There are, however, some classes of computer systems whose functions are more limited
and whose objective is to deal with limited computation domains.
Embedded computers are the most prevalent form of computers in existence. These devices
are found everywhere, from car engines and manufacturing robots to DVDs and microwave
ovens. They tend to have very specific tasks. The systems they run on are usually primitive, and
so the operating systems provide limited features. Usually, they have little or no user interface,
preferring to spend their time monitoring and managing hardware devices, such as automobile
engines and robotic arms.
These embedded systems vary considerably. Some are general-purpose computers, running
standard operating systems-such as UNIX-with special-purpose applications to implement the
functionality. Others are hardware devices with a special-purpose embedded operating system
providing just the functionality desired. Yet others are hardware devices with application-
specific integrated circuits (ASICs) that perform their tasks without an operating system.
The use of embedded systems continues to expand. The power of these devices, both as
standalone units and as elements of networks and the Web, is sure to increase as well. Even now,
entire houses can be computerized, so that a central computer-either a general-purpose computer
or an embedded system-can control heating and lighting, alarm systems, and even coffee makers.
Web access can enable a home owner to tell the house to heat up before she arrives home.
Someday, the refrigerator may call the grocery store when it notices the milk is gone.
11
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
Embedded systems almost always run real-time operating systems. Areal-time system is
used when rigid time requirements have been placed on the operation of a processor or the flow
of data; thus, it is often used as a control device in a dedicated application. Sensors bring data to
the computer. The computer must analyze the data and possibly adjust controls to modify the
sensor inputs. Systems that control scientific experiments, medical imaging systems, industrial
control systems, and certain display systems are real-time systems. Some automobile-engine
fuel- injection systems, home-appliance controllers, and weapon systems are also real-time
systems.
A real-time system has well-defined, fixed time constraints. Processing must be done within
the defined constraints, or the system will fail. For instance, it would not do for a robot arm to be
instructed to halt after it had smashed into the car it was building. A real-time system functions
correctly only if it returns the correct result within its time constraints. Contrast this system with
a time-sharing system, where it is desirable (but not mandatory) to respond quickly or a batch
system, which may have no time constraints at all.
2. Multimedia Systems
Most operating systems are designed to handle conventional data such as text files, programs,
word-processing documents, and spreadsheets. However, a recent trend in technology is the
incorporation of multimedia data into computer systems. Multimedia data consist of audio and
video files as well as conventional files. These data differ from conventional data in that
multimedia data-such as frames of video-must be delivered (streamed) according to certain time
restrictions (for example, 30 frames per second).
Multimedia describes a wide range of applications in popular use today. These include audio
files such as MP3, DVD movies, video conferencing, and short video clips of movie previews or
news stories downloaded over the Internet. Multimedia applications may also include live
webcasts (broadcasting over the World Wide Web) of speeches or sporting events and even live
webcams that allow a viewer in Manhattan to observe customers at a cafein Paris. Multimedia
applications need not be either audio or video; rather, a multimedia application often includes a
combination of both. For example, a movie may consist of separate audio and video tracks. Nor
must multimedia applications be delivered only to desktop personal computers. Increasingly,
they are being directed toward smaller devices, including PDAs and cellular telephones.
3. Handheld Systems
Handheld Systems include personal digital assistants (PDAs), such as Palm and Pocket-PCs,
and cellular telephones, many of which use special-purpose embedded operating systems.
Developers of handheld systems and applications face many challenges, most of which are due
to the limited size of such devices. For example, a PDA is typically about 5 inches in height and
3 inches in width, and it weighs less than one-half pound. Because of their size, most handheld
devices have small amounts of memory, slow processors, and small display screens.
The amount of physical memory in a handheld depends on the device, but typically it is
12
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
somewhere between 1 MB and 1 GB. (Contrast this with a typical or workstation, which may
13
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
have several gigabytes of memory.) As a result, the operating system and applications must
manage memory efficiently. This includes returning all allocated memory to the memory
manager when the memory is not being used.
A second issue of concern to developers of handheld devices is the speed of the processor
used in the devices. Processors for most handheld devices run at a fraction of the speed of a
processor in a PC. Faster processors require more power. To include a faster processor in a
handheld device would require a larger battery, which would take up more space and would have
to be replaced (or recharged) more frequently. Most handheld devices use smaller, slower
processors that consume less power. Therefore, the operating system and applications must be
designed not to tax the processor.
The last issue confronting program designers for handheld devices is I/O. A lack of physical
space limits input methods to small keyboards, handwriting recognition, or small screen-based
keyboards. The small display screens limit output options. Whereas a monitor for a home
computer may measure up to30 inches, the display for a handheld device is often no more than 3
inches square. Familiar tasks, such as reading e-mail and browsing Web pages, must be
condensed into smaller displays.
Some handheld devices use wireless technology, such as Bluetooth or802.11, allowing
remote access to e-mail and Web browsing. Cellular telephones with connectivity to the Internet
fall into this category. However, for PDAs that do not provide wireless access, downloading data
typically requires the user first to download the data to a PC or workstation and then download
the data to the PDA. Some PDAs allow data to be directly copied from one device to another
using an infrared link.
SYSTEM CALLS
System calls provide an interface to the services made available by an operating system.
These calls are generally available as routines written in C and C++, although certain low-level
tasks (for example, tasks where hardware must be accessed directly), may need to be written
using assembly-language instructions.
Writing a simple program to read data from one file and copy them to another file. The
first input that the program will need is the names of the two files: the input file and the output
file. In an interactive system, this approach will require a sequence of system calls, first to write
a prompting message on the screen and then to read from the keyboard the characters that define
the two files. On mouse-based and icon-based systems, a menu of file names is usually displayed
in a window. The user can then use the mouse to select the source name, and a window can be
opened for the destination name to be specified. This sequence requires many I/O system calls.
14
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
Once the two file names are obtained, the program must open the input file and create the
output file. Each of these operations requires another system call. There are also possible error
conditions for each operation. When the program tries to open the input file, it may find that
there is no file of that name or that the file is protected against access. In these cases, the
program should print a message on the console (another sequence of system calls) and then
terminate abnormally (another system call). If the input file exists, then we must create a new
output file. We may find that there is already an output file with the same name. This situation
may cause the program to abort (a system call), or we may delete the existing file (another
system call) and create a new one (another system call). Another option, in an interactive system,
is to ask the user (via a sequence of system calls to output the prompting message and to read the
response from the terminal) whether to replace the existing file or to abort the program.
Now that both files are set up, we enter a loop that reads from the input file (a system
call) and writes to the output file (another system call). Each read and write must return status
information regarding various possible error conditions. On input, the program may find that the
end of the file has been reached or that there was a hardware failure in the read (such as a parity
error). The write operation may encounter various errors, depending on the output device (no
more disk space, printer out of paper, and so on).
Finally, after the entire file is copied, the program may close both files (another system
call), write a message to the console or window (more system calls), and finally terminate
normally (the final system call). As we can see, even simple programs may make heavy use of
the operating system. Frequently/ systems execute thousands of systems calls per second. This
system call sequence is shown in Figure 1.5.
15
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
System calls can be grouped roughly into six major categories: process control, file
manipulation, device manipulation, information maintenance, communication, and
protection.
1. Process Control
A running program needs to be able to halt its execution either normally (end)or abnormally
(abort). If a system call is made to terminate the currently running program abnormally, or if the
program runs into a problem and causes an error trap, a dump of memory is sometimes taken and
an error message generated. The dump is written to disk and may be examined by a debugger (a
system program designed to aid the programmer in finding and correcting bugs) to determine the
cause of the problem. Under either normal or abnormal circumstances, the operating system must
transfer control to the invoking command interpreter. The command interpreter then reads the
next command. In an interactive system, the command interpreter simply continues with the next
command; it is assumed that the user will issue an appropriate command to respond to any error.
A process or job executing one program may want to load execute another program. This
16
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
feature allows the command interpreter to execute program as directed by, for example, a
17
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
user command, the click of a mouse, or a batch command. If control returns to the existing
program when the new program terminates, we must save the memory image of the existing
program; thus, we have effectively created a mechanism for one program to call another
program. If both programs continue concurrently, we have created a new job or process to be
multi programmed. Often, there is a system call specifically for this purpose (create process or
submit job).
If we create a new job or process, or perhaps even a set of jobs or processes, we should be
able to control its execution. This control requires the ability to determine and reset the attributes
of a job or process, including the job’s priority, its maximum allowable execution time, and so
on (get process attributes and set process attributes). We may also want to terminate a job or
process that we created (terminate process) if we find that it is incorrect or is no longer needed.
Having created new jobs or processes, we may need to wait for them to finish their
execution. We may want to wait for a certain amount of time to pass (wait time); more probably,
we will want to wait for a specific event to occur (wait event). The jobs or processes should then
signal when that event has occurred (signal event). To ensure the integrity of the data being
shared, operating systems often provide system calls allowing a process to lock shared data, thus
preventing another process from accessing the data while it is locked. Typically, such system
calls include acquire lock and release lock.
18
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
To start a new process, the shell executes a fork() system call. Then, the selected program
is loaded into memory via an exec() system call, and the program is executed. When the process
is done, it executes an exit() system call to terminate, returning to the invoking process a status
code of 0 or a non-zero error code.
2. File Management
To create and delete files. Either system call requires the name of the file and perhaps some
of the file's attributes. Once the file is created, we need to open it and to use it. We may also
read, write, or reposition (rewinding or skipping to the end of the file, for example). Finally, we
need to close the file, indicating that we are no longer using it.
19
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
We may need these same sets of operations for directories if we have a directory structure for
organizing files in the file system. In addition, for either files or directories, we need to be able to
determine the values of various attributes and perhaps to reset them if necessary. File attributes
include the file name, file type, protection codes, accounting information, and so on. At least two
system calls, get file attribute and set file attribute, are required for this function. Some
operating systems provide many more calls, such as calls for file move and copy.
3. Device Management
A process may need several resources to execute-main memory, disk drives, access to files,
and so on. If the resources are available, they can be granted, and control can be returned to the
user process. Otherwise, the process will have to wait until sufficient resources are available.
The various resources controlled by the operating system can be thought of as devices. Some
of these devices are physical devices (for example, disk drives), while others can be thought of as
abstract or virtual devices (for example, files). A system with multiple users may require us to
first request the device, to ensure exclusive use of it. After we are finished with the device, we
release it. Once the device has been requested (and allocated to us), we can read, write, and
(possibly) reposition the device, just as we can with files.
4. Information Maintenance
Many system calls exist simply for the purpose of transferring information between the user
program and the operating system. For example, most systems have a system call to return the
current time and date. Other system calls may return information about the system, such as the
number of current users, the version number of the operating system, the amount of free memory
or disk space, and so on.
Another set of system calls is helpful in debugging a program. Many systems provide
system calls to dump memory. This provision is useful for debugging. A program trace lists each
system call as it is executed. Even microprocessors provide a CPU mode known as single step, in
which a trap is executed by the CPU after every instruction. The trap is usually caught by a
debugger.
Many operating systems provide a time profile of a program to indicate the amount of
time that the program executes at a particular location or setoff locations. A time profile requires
either a tracing facility or regular timer interrupts.
In addition, the operating system keeps information about all its processes, and system
calls are used to access this information. Generally, calls are also used to reset the process
information (get process attributes and set process attributes).
20
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
5. Communication
There are two common models for interprocess communication: the message passing model
and the shared-memory model.
In the message-passing model, the communication process exchanges messages with one
another to transfer information. Messages can be exchanged between the processes either directly
or indirectly through a common mailbox. Each computer in a network has a host name by which
it is commonly known. A host also has a network identifier, such as an IP address. Similarly,
each process has a process name, and this name is translated into an identifier by which the
operating system can refer to the process. The gethostid() and getprocessid() system calls do this
translation. The identifiers are then passed to the general purpose open and close calls provided
by the file system or to specific openconnection() and closeconnection() system calls, depending
on the system's model of communication. The recipient process usually must give its permission
for communication to take place with an accept connection call. They execute a wait for
connection call and are awakened when a connection is made. The source of the communication,
known as the client, and the receiving daemons, known as a server, then exchange messages by
using read message and write message system calls. The close connection call terminates the
communication.
6. Protection
Protection provides a mechanism for controlling access to the resources provided by a
computer system. Typically, system calls providing protection include set permission and get
permission, which manipulate the permission settings of resources such as files and disks. The
allow user and deny user system calls specify whether particular users can-or cannot-be allowed
access to certain resources.
1. Simple Structure-
Many commercial operating systems do not have well-defined structures. Frequently, such
systems started as small, simple, and limited systems and then grew beyond their original scope.
MS-DOS is an example of such a system. It was originally designed and implemented by a few
people who had no idea that it would become so popular. It was written to provide the most
functionality in the least space, so it was not divided into modules carefully. Figure 1.7 shows its
21
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
structure.
22
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
In MS-DOS, the interfaces and levels of functionality are not well separated. For instance,
application programs are able to access the basic I/O routines to write directly to the display and
disk drives. Such freedom leaves MS-DOS vulnerable to errant (or malicious) programs, causing
entire system crashes when user programs fail. Of course, MS-DOS was also limited by the
hardware of its era.
Another example of limited structuring is the original UNIX operating system. Like MS-
DOS, UNIX initially was limited by hardware functionality.
23
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
It consists of two separable parts: the kernal and the system programs. The Kernal is further
separated into a series of interfaces and device drivers, which have been added and expanded
over the years as UNIX has evolved. We can view the traditional UNIX operating system as
being layered, as shown in Figure 1.8.
Everything below the system-call interface and above the physical hardware is the kernel.
The Kernal provides the file system, CPU scheduling, memory management, and other
operating- system functions through system calls. In this enormous amount of functionality to be
combined into one level. This monolithic structure was difficult to implement and maintain.
2. Layered Approach
Another approach is to break the OS into a number of smaller layers, each of which rests on the
layer below it, and relies solely on the services provided by the next lower layer. This approach
allows each layer to be developed and debugged independently, with the assumption that all
lower layers have already been debugged and are trusted to deliver proper services.
The problem is deciding what order in which to place the layers, as no layer can call upon the
services of any higher layer. Layered approaches can also be less efficient, as a request for
service from a higher layer has to filter through all lower layers before it reaches the HW,
possibly with significant processing at each step.
24
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
3. Microkernels
The basic idea behind micro kernels is to remove all non-essential services from the kernel,
and implement them as system applications instead, thereby making the kernel as small and
efficient as possible. Most microkernels provide basic process and memory management, and
message passing between other services, and not much more. Security and protection can be
enhanced, as most services are performed in user mode, not kernel mode. System expansion can
also be easier, because it only involves adding more system applications, not rebuilding a new
kernel.
Mach was the first and most widely known microkernel, and now forms a major component
of Mac OSX. Windows NT was originally microkernel, but suffered from performance problems
relative to Windows 95. NT 4.0 improved performance by moving more services into the kernel,
and now XP is back to being more monolithic. Another microkernel example is QNX, a real-
time OS for embedded systems.
4. Modules
Modern OS development is object-oriented, with a relatively small core kernel and a set of
modules which can be linked in dynamically. For example, the Solaris structure, as shown in
Figure 1.11 below.
Modules are similar to layers in that each subsystem has clearly defined tasks and interfaces,
but any module is free to contact any other module, eliminating the problems of going through
multiple intermediary layers. The kernel is relatively small in this architecture, similar to
microkernels, but the kernel does not have to implement message passing since modules are free
to contact each other directly.
25
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
5. Hybrid Systems
Most OSs today do not strictly adhere to one architecture, but are hybrids of several.
5.1 Mac OS X
The Max OSX architecture relies on the Mach microkernel for basic system management
services, and the BSD kernel for additional services. Application services and dynamically
loadable modules (kernel extensions) provide the rest of the OS functionality.
5.2 iOS
The iOS operating system was developed by Apple for iPhones and iPads. It runs with less
memory and computing power needs than Max OS X, and supports touchscreen interface and
graphics for small screens.
5.3 Android
The Android OS was developed for Android smartphones and tablets by the Open Handset
Alliance, primarily Google. Android is an open-source OS, as opposed to iOS, which has led to
26
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
its popularity. Android includes versions of Linux and a Java virtual machine both optimized for
small platforms. Android apps are developed using a special Java-for-Android development
environment.
System Program:
System programming may be defined as the act of creating System Software by using the System
Programming Languages. A system program offers an environment in which programs may be
developed and run. In simple terms, the system programs serve as a link between the user interface
(UI) and system calls. Some system programs are only user interfaces, and others are complex. For
instance, a compiler is complicated system software.
The system program is a component of the OS, and it typically lies between the user interface
(UI) and system calls. The system user view is defined by the system programs, not the system call,
because the user view interacts with system programs and is closer to the user interface.
There are mainly six types of system programs. These are classified as follows:
1. File Management
2. Status Information
3. File Modification
4. Programming-Language support
5. Program Loading and Execution
6. Communication
Now, you will learn all these different types of system programs one by one.
File Management
Status Information
Status information is information about the input, output process, storage, and CPU utilization time,
how the process will be computed in how much memory is necessary to execute a task.
27
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
File Modification
These system programs are utilized to change files on hard drives or other storage media. Besides
modification, these programs are also utilized to search for content within a file or to change content
within a file.
Programming-Language Support
The OS includes certain standard system programs that allow programming languages such as C,
Visual Basic, C++, Java, and Pearl. There are various system programs, including compilers,
debuggers, assemblers, interpreters, etc.
After Assembling and Compiling, the program must be loaded into the memory for execution. A
loader is a component of an operating system responsible for loading programs and libraries, and it
is one of the most important steps to starting a program. The system includes linkage editors,
relocatable loaders, Overlay loaders, and loaders.
Communication
System program offers virtual links between processes, people, and computer systems. Users may
browse websites, log in remotely, communicate messages to other users via their screens, send
emails, and transfer files from one user to another.
SYSTEM BOOT
After an operating system is generated, it must be made available for use by the
hardware. But how does the hardware know where the kernel is or how to load that kernel? The
procedure of starting a computer by loading the kernel is known as booting the system. On most
computer systems, a small piece of code known as the bootstrap program or bootstrap loader
locates the kernel, loads it into main memory, and starts its execution. Some computer systems,
such as PCs, use a two-step process in which a simple bootstrap loader fetches a more complex
boot program from disk, which in turn loads the kernel.
When a CPU receives a reset event--for instance, when it is powered up or rebooted --the
instruction register is loaded with a predefined memory location, and execution starts there. At
that location is the initial boot strap program. This program is in the form of read-only memory
(ROM), because the RAM is in an unknown state at system startup. ROM is convenient because
it needs no initialization and cannot easily be infected by a computer virus.
The bootstrap program can perform a variety of tasks. Usually, one task is to run
diagnostics to determine the state of the machine. If the diagnostics pass, the program can
continue with the booting steps. It can also initialize all aspects of the system, from CPU
registers to device controllers and the contents of main memory. Sooner or later, it starts the
28
SFIT, Borivali
Class-SE (A&B) Subject:Operating System Subject Teacher: [Link] Rane
****************************************************************************************
operating system. Some systems, such as cellular phones, PDAs, and game consoles store the
entire operating system in ROM. A problem with this approach is that changing the bootstrap
code requires changing the ROM hardware chips. Some systems resolve this problem by using
erasable programmable read-only memory (EPROM), which is read-only except when
explicitly given a command to become writable. All forms of ROM are also known as firmware,
since their characteristics fall somewhere between those of hardware and those of software.
For large operating systems (including most general-purpose operating systems like
Windows, Mac OS X, and UNIX) or for systems that change frequently, the bootstrap loader is
stored in firmware, and the operating system is on disk. In this case, the bootstrap runs
diagnostics and has a bit of code that can read a single block at a fixed location (say block zero)
from disk into memory and execute the code from that boot block. More typically, it is simple
code (as it fits in a single disk block) and knows only the address on disk and length of the
remainder of the bootstrap program. GRUB is an example of an open-source bootstrap program
for Linux systems. All of the disk-bound bootstrap, and the operating system itself, can be easily
changed by writing new versions to disk. A disk that has a boot partition is called a boot disk or
system disk.
Now that the full bootstrap program has been loaded, it can traverse the file system to
find the operating system kernel, load it into memory, and start its execution. It is only at this
point that the system is said to be running.
29