OPerating System Unit 1
OPerating System Unit 1
UNIT - I
Introduction to Operating System Concept:
Types of operating Systems
Operating Systems concepts
Operating systems Services
Introduction to System call
System calls types.
Advantages: The multiple users can share the batch systems and idle time is very less.
Disadvantages: It is costly and difficult to debug.
2. Multi-Tasking/Time-sharing Operating Systems: Each task is given some time to execute
so that all the tasks work smoothly. Each user gets the time of CPU as they use a single system.
These systems are also known as Multitasking Systems. The task can be from a single user or
different users also. The time that each task gets to execute is called quantum. After this time
interval is over OS switches over to the next task.
Advantages: Each task gets an equal opportunity and CPU idle time can be reduced.
Disadvantages: Reliability and data communication problem.
3.Distributed Operating System: It use multiple central processors to serve multiple real-time
applications and multiple users. Data processing jobs are distributed among the processors. The
processors communicate with one another through various communication lines .These are
referred as loosely coupled systems or distributed Operating systems.
Advantages: It provides sharing of resources and fault-tolerant.
Disadvantages: It can dominate computation cost.
4. Real-Time Operating System: The time interval required to process and respond to inputs is
very small. This time interval is called response time. Real-time Operating systems are used
when there are time requirements that are very strict like missile systems, air traffic control
systems, robots, etc. There are two types
(A).Hard Real-Time Systems: These OSs is meant for applications where time constraints
are very strict and even the shortest possible delay is not acceptable. These systems are built
for saving life like automatic parachutes or airbags which are required to be readily available in
case of any accident. Virtual memory is rarely found in these systems.
(B).Soft Real-Time Systems: These OSs is for applications where for time-constraint is less
strict.
Advantages: Easy to layout, develop and execute real-time applications and maximum
utilization of devices and systems.
Disadvantages: These are very costly to develop and complex, consume critical CPU cycles.
5.Multi-Programming Operating System: Multiprogramming is an extension to batch
processing where the CPU is always kept busy. Each process needs two types of system time:
CPU time and IO time. In a multiprogramming environment, when a process does its I/O, The
CPU can start the execution of other processes. Therefore, multiprogramming improves the
efficiency of the system.
Advantages: Response time can also be reduced.
6. Multiprocessing Operating System: There are more than one processors present in the
system which can execute more than one process at the same time. This will increase the
throughput of the system.
Advantages: This increases reliability and more work can be done in less.
Disadvantages: It is more complex.
7. Network Operating System: Network Operating System runs on a server. It provides the
capability to serve to manage data, user, groups, security, application, and other networking
functions.
------------------------------------XXXXXXXXXXXXXXX-------------------------------------------
2. Explain the operating System Concepts.
1. Processes: A process is basically a program in execution. Associated with each process is its
address space, a list of memory locations from 0 to some maximum, which the process can read
and write. The address space contains the executable program, the program’s data, and its stack.
Also associated with each process is a set of resources, commonly including registers (including
the program counter and stack pointer), a list of open files, outstanding alarms, lists of related
processes, and all the other information needed to run the program. In many operating systems,
all the information about each process, other than the contents of its own address space, is stored
in an operating system table called the process table.
4. Input/output: Every operating system has an I/O subsystem for managing its I/O devices.
Some of the I/O software is device independent, that is, applies to many or all I/O devices
equally well.
5. Protection: Computers contain large amounts of information that users often want to protect
and keep confidential. This information may include email, business plans, tax returns, and much
more. Files in UNIX are protected by assigning each one a 9-bit binary protection code. The
protection code consists of three 3-bit fields, one for the owner, one for other members of the
owner’s group and one for everyone else. Each field has a bit for read access, a bit for write
access, and a bit for execute access. These 3 bits are known as the rwx bits.
6. The Shell: The user is using a graphical user interface. Many shells exist, including sh, csh,
ksh, and bash. All of them support the functionality described below, which derives from the
original shell (sh). When any user logs in, a shell is started up. The shell has the terminal as
Department of Computer Science, TJPS College, Guntur. 6
Prepared by KADIRI NAGESWARA RAO. MCA
II BSC (Semester IV) Operating Systems
standard input and standard output. It starts out by typing the prompt, a character such as a
dollar sign, which tells the user that the shell is waiting to accept a command. For Example
date >file
7. Ontogeny Recapitulates Phylogeny:
A) Large Memories : The first mainframes had limited memory. A fully loaded IBM 7090 or 7094,
which played king of the mountain from late 1959 until 1964, had just over 128 KB of memory. The first
commercial minicomputer (the PDP-1) was released, it had only 4096 18-bit words of memory, and
assembly language made a surprise comeback. When microcomputers hit in the early 1980s, the first ones
had 4-KB memories and assembly-language programming rose from the dead. Embedded computers
often used the same CPU chips as the microcomputers (8080s, Z80s, and later 8086s) and were also
programmed in assembler initially.
B) Protection Hardware: The introduction of the IBM 360, a primitive form of hardware protection
became available. These machines could then hold several programs in memory at the same time and let
them take turns running (multiprogramming). When the first microcomputers were built, they used the
Intel 8080 CPU chip, which had no hardware protection, so we were back to monoprogramming one
program in memory at a time. It was not until the Intel 80286 chip that protection hardware was added
and multiprogramming became possible.
C) Disks: IBM introduced the first hard disk—the RAMAC (RAndoM ACcess) in 1956. Users
could create so-called ‘‘permanent files’’ by giving them names and hoping that no other user
had also decided that, say, ‘‘data’’ was a suitable name for a file. This was a single-level
directory. Eventually, mainframes developed complex hierarchical file systems, perhaps
culminating in the MULTICS file system.
D) Virtual Memory: Virtual memory also allowed having a program dynamically link in a
library at run time instead of having it compiled in. MULTICS was the first system to allow this.
--------------------------------------XXXXXXXXXXXXX------------------------------------------------
3. What are the operating systems services?
An operating system provides an environment for the execution of programs. It provides
certain services to programs and to the users of those programs. The services are provided for the
convenience of the programmer, to make the programming task easier.
First use an example to illustrate how system calls are used: 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.
One approach is for the program to ask the user for the names. 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 program should print a message on the console and then terminate abnormally.
If the input file exists, then we must create a new output file. There is already an output file with
the same name. This situation may cause the program to abort, or we may delete the existing file
and create a new one.
The write operation may encounter various errors, depending on the output device.
Finally, after the entire file is copied, the program may close both files; write a message to the
console or window, and finally terminate normally.
The API specifies a set of functions that are available to an application programmer,
including the parameters that are passed to each function and the return values the programmer
can expect. Three of the most common APIs available to application programmers are the
Windows API for Windows systems, the POSIX API for POSIX-based systems and the Java API
for programs that run on the Java virtual machine.
An application programmer designing a program using an API can expect her program
to compile and run on any system that supports the same API. A strong correlation between a
function in the API and its associated system call within the kernel.
The run-time support system provides a System Call Interface that serves as the link to
system calls made available by the operating system. A number is associated with each system
call, and the system-call interface maintains a table indexed according to these numbers. The
system call interface then invokes the intended system call in the operating-system kernel and
returns the status of the system call and any return values. The relationship between an API, the
Three general methods are used to pass parameters to the operating system.
1. The simplest approach is to pass the parameters in registers.
2. The parameters are generally stored in a block, or table, in memory, and the address of the
block is passed as a parameter in a register. This is the approach taken by Linux and Solaris.
3. Parameters also can be placed or pushed, onto the stack by the program and popped off the
stack by the operating system.
Some operating systems prefer the block or stack method because those approaches do
not limit the number or length of parameters being passed.
------------------------------XXXXXXXXXXXXXXX---------------------------------------------------
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 errors, or 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.
In a GUI system, a pop-up window might alert the user to the error and ask for guidance.
In a batch system, the command interpreter usually terminates the entire job and continues with
the next job.
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 multiprogrammed (create process() or submit job()).