You are on page 1of 24

COURSE OUTCOMES:

The theory, practical experiences and relevant soft skills associated with this course are to be
taught and implemented, so that the student demonstrates the following industry oriented
COs associated with the above mentioned competency:

a. Install operating system and configure it.

b. Use operating system tools to perform various functions.

c. Execute process commands for performing process management operations. d. Apply


scheduling algorithms to calculate turnaround time and average waiting time.

e. Calculate efficiency of different memory management techniques.

f. Apply file management techniques.

1
TYPES OF OPERATING SYSTEM
I. Batch Systems:

Main function of a batch processing system is to automatically keep executing the jobs in a
batch. A batch operating system normally reads a stream of separate jobs (from a card
reader. For example,), each with its own control cards that predefine to prevent errors and
improper use of the computer. It is concerned with the operation and control if I/O devices.

A batch system is one in which jobs are bundled together with the instruction necessary to
allow them to be processed without intervention. Often jobs of a similar nature can be
bundled together to further increase economy. Common input devices were card readers and
tape drives. The basic physical layout of the memory of batch job computer is shown in fig.
The OS was simple; its major task was to transfer control from one job to the next. The job
was submitted to the computer operator in form of punch cards. At some later time, the
output appeared. The OS was always resident in memory. Often magnetic tapes and drums
were used to store intermediate data and compiled programs.
Example: Payroll system, stock control and billing systems.

Advantages of batch systems:-

 No need of special hardware and system support to input data in batch systems.
 Best for large organizations but small organizations can also benefit from it.
 Batch systems can work offline so it makes less stress on processor.
 Sharing of batch system for multiple users.
 The batch systems can manage large repeated work easily.

Disadvantages of batch processing systems:-

 Computer operators must be trained for using batch systems.


 It is difficult to debug batch systems.
 Batch systems are sometime costly.
 If some job takes too much time i.e. if error occurs in job then other jobs will wait for
unknown time

2
II. Multiprogramming:

Multiprogramming is a rudimentary form of parallel processing in which several programs


are run at the same time on a uniprocessor. Since there is only one processor, there can be no
true simultaneous execution of different programs. Instead, the operating system executes
part of one program, then part of another, and so on. To the user it appears that all programs
are executing at the same time.

Multiprogramming needed for efficiency:


• Single user cannot keep CPU and I/O devices busy at all times.
• Multiprogramming organizes jobs (code and data) so CPU always has one to execute.
• A subset of total jobs in system is kept in memory.
• One job selected and run via job scheduling.
• When it has to wait (for I/O for example), OS switches to another job. It executes multiple
programs simultaneously by a single processor.

Multiprogramming is a technique used to utilize maximum CPU time by running multiple


programs simultaneously. The execution begins with the first program and continues till an
instruction waiting for a peripheral is reached, the context of this program is stored, and the
second program in memory is given a chance to run. The process continued until all programs
finished running. Multiprogramming has no guarantee that a program will run in a timely
manner. Usually on a mainframe - the computer has a number of programs loaded into
memory and the operating system switches quickly between them, processing a little bit of
each one in turn. The high speed of the processor makes it seem like more than one program
is being run at the same time. On a PC it is usually called multitasking. If the machine has the
capability of causing an interrupt after a specified time interval, then the operating system
will execute each program for a given length of time, regain control, and then execute another
program for a given length of time, and so on. In a system without memory protection, one
program can change the contents of storage assigned to other programs or even the storage
assigned to the operating system. The resulting system crashes are not only disruptive, they
may be very difficult to debug since it may not be obvious which of several programs is at
fault. If memory can hold several programs, then CPU can switch to another one whenever a
program is a waiting for an I/O to complete.

3
III. Time-Sharing Systems:

Interactive Computing: In time sharing system, the CPU executes multiple jobs by switching
among them. The main idea of time sharing systems is to allow a large number of users to
interact with a single computer system concurrently. In time sharing system, the CPU
executes multiple jobs by switching among them. The switches occur so frequently that the
users can interact with each program while it is running.

A time sharing system allows many users to share the computer resources simultaneously.
Since each action or command in a time shared system tends to be short, only a little CPU
time is needed for each user. As the system switches rapidly from one user to the next, each
user is given the impression that the entire computer system is dedicated to his use, even
though it is being shared among many users. The systems were developed to provide an
interactive use of the computer system. Most time sharing systems use time-slicing (Round
Robin) scheduling. A program executing longer than the system defined time slice is
interrupted by the operating system and place at the end of the queue of waiting programs for
execution.

Example:

In above figure the user 5 is active but user 1, user 2, user 3, and user 4 are in waiting state
whereas user 6 is in ready status. As soon as the time slice of user 5 is completed, the control
moves on to the next ready user i.e. user 6. In this state user 2, user 3, user 4, and user 5 are in
waiting state and user 1 is in ready state. The process continues in the same way and so on.

4
IV. Multiprocessor OS:
Multiprocessor systems are also known as parallel systems or tightly coupled systems. These
systems have two or more processors in close communication and they share computer
resources such as bus, clock, memory and peripheral devices. The whole task of
multiprocessing is managed by the operating system, which allocates different tasks to be
performed by the various processors in the system. Applications designed for the use in
multiprocessing are said to be threaded, which means that they are broken into smaller

routines that can be run independently. This allows the operating system to let these threads
run on more than one processor simultaneously, which is multiprocessing that results in
improved performance. Generally, the parallel processing is used in the fields like artificial
intelligence and expert system, image processing, weather forecasting etc.

5
V. Real Time OS:
Real time system has well defined fixed time constraints. Processing should be done within
the Defined constraints. A primary objective of real-time systems is to provide quick event
response time and thus meet the scheduling deadlines. User convenience and resource
utilization are of secondary concern to real-time system designers. In Real time systems,
processor is allocated to the highest priority process among those that are ready to execute.
Higher priority processes preempt execution of the lower priority processes. This form is
called as ‘priority–based preemptive scheduling’. The primary functions of the real time
operating system are to:
 Manage the processor and other system resources to meet the requirements of an
application.
 Synchronize with and respond to the system events.
 Move the data efficiently among processes and to perform coordination among
these processes.

Types of real time system:


1. Hard Real Time: - Hard real time means strict about adherence to each task deadline.
When an event occurs, it should be serviced within the predictable time at all times in a given
hard real time system.
Example: Video Transmission, each picture frame and audio must be transferred at fixed rate.
2. Soft Real Time: Soft real time means that only the precedence and sequence for the task
operations are defined, interrupt latencies and context switching latencies are small. There
can be few deviations between expected latencies of the tasks and observed time constraints
and a few deadline misses are accepted.
Example: Mobile phone, Digital Cameras and orchestra playing robots.

6
VI. Distributed Operating System

A distributed system consists of a collection of autonomous computers, connected through a


network and distribution middleware, which enables computers to coordinate their activities
and to share the resources of the system, so that users perceive the system as a single,
integrated computing facility.
 In such system the processors do not share memory or a clock; instead each processor
has its own local memory.
 In such systems, if one machine or site fails the remaining sites can continue
operation.
 So these types of systems are the reliable systems.
 The processors communicate with one another through various communications lines,
such as a high speed buses or telephone lines.
 These systems are usually referred to as Loosely Coupled Systems or Distributed
Systems
 The structure shown in figure contains a set of individual computer
 By this structure we cannot say it is a distributed system because it is the software, not
the hardware, that determines whether a system is distributed or not.
 The users of a true distributed system should not know, on which machine their
programs are running and where their files are stored.

7
VII. Mobile OS

Mobile computing refers to computing on handheld smartphones and tablet computers.


These devices share the distinguishing physical features of being portable and lightweight.
Historically, compared with desktop and laptop computers, mobile systems gave up screen
size, memory capacity, and overall functionality in return for handheld mobile access to
services such as e-mail and web browsing. Today, mobile systems are used not only for e-
mail and web browsing but also for playing music and video, reading digital books, taking
photos, and recording high-definition video. Two operating systems currently dominate
mobile computing: Apple iOS andGoogle Android. iOS was designed to run on Apple
iPhone and iPad mobile devices. Android powers smartphones and tablet computers available
from many manufacturers.

iOS
iOS is a mobile operating system designed by Apple to run its smartphone, the iPhone, as
well as its tablet computer, the iPad. iOS is structured on the Mac OS X operating system,
with added functionality pertinent to mobile devices, but does not directly run Mac OS X
applications. The structure of iOS appears in the following figure.

Cocoa Touch is an API for Objective-C that provides several frameworks for developing
applications that run on iOS devices. The fundamental difference between Cocoa, mentioned
earlier, and Cocoa Touch is that the latter provides support for hardware features unique to
mobile devices, such as touch screens.
The media services layer provides services for graphics, audio, and video.
The core services layer provides a variety of features, including support for cloud computing
and databases. The bottom layer represents the core operating system, which is based on the
kernel environment.

Android
The Android operating system was designed by the Open Handset Alliance (led primarily by
Google) and was developed for Android smartphones and tablet computers. Whereas iOS is
designed to run on Apple mobile devices and is close-sourced, Android runs on a variety of
mobile platforms and is open-sourced, partly explaining its rapid rise in popularity. The
structure of Android is shown in the figure below

8
Figure: Architecture of Google’s Android

Android is similar to iOS in that it is a layered stack of software that provides a rich set of
frameworks for developing mobile applications. At the bottom of this software stack is the
Linux kernel, although it has been modified by Google and is currently outside the normal
distribution of Linux releases. Linux is used primarily for process, memory, and device-
driver support for hardware and has been expanded to include power management. The
Android runtime environment includes a core set of libraries as well as the Dalvik virtual
machine. Software designers for Android devices develop applications in the Java language.
However, rather than using the standard Java API, Google has designed a separate Android
API for Java development. The Java class files are first compiled to Java bytecode and then
translated into an executable file that runs on the Dalvik virtual machine. The Dalvik virtual
machine was designed for Android and is optimized for mobile devices with limited memory
and CPU processing capabilities. The set of libraries available for Android applications
includes frameworks for developing web browsers (webkit), database support (SQLite), and
multimedia.
The libc library is similar to the standard C library but is much smaller and has been designed
for the slower CPUs that characterize mobile devices.

9
COMMANDS

 General purpose utilities Command

1. $date: It displays system date and time.


Syntax: $date “%d%m%y”

2. $cal : Display calendar for current month.


Syntax: $cal <date>

3. clear: It is used to lears the screen.


Syntax: $clear

4. banner: Display an argument string as a poster with maximum of ten character per
line.
Syntax : $banner <name>

5. tty: Name of terminal


Syntax: $tty
6. who: who command tells you the users currently logged on to the system
Syntax: $who
7. who am i: Display the details of the current working directory.
Syntax: $who am i

10
8. passwd: Command is used to change your password.
Syntax: $passwd <uname>
9. su(sudo): Provide a super user priviledges.
Syntax: $su ls

10. pwd: pwd(Parent Working Directory)is used To print the complete path
of the current working directory.
Syntax: $pwd

11
 Process related Commands

1) Ps: Display the characteristics of a process. ( ie. Terminal number, time required,
PID number, command name)
$ps –f: Full listening showing PPID of each process.
$ps –a : Process of all user.
$ps –e : Processes including user and system process.
$ps –u username : Display’s processes of user ‘username’.

Syntax: $ps

2) Wait: Waits until all background processes are complete and then exits.
Syntax: $wait

3) sleep 3: Used to execute commands after certain amount of time by sleeping for
given second.
Syntax: $sleep

12
4) exit: Used to quit the shell.
Syntax:$exit

5) kill 0 : Used to stop execution of particular process by sending an interrupt single to


the process.
$kill -9 0 : Kill all processes including login shell.
$kill -9$$ : Kills login shell.
$kill 120 230 234 : Kills three processes with pid 120 230 234

13
 File and Directory manipulation command

1. ls : It is used to lists file in the current working directory.


Options : -a : List all file including hidden files starting with ‘.’
-d : List directories – with ‘*/’
-i : List files inode index number.

Syntax: ls –l<filename>

2. rm: It is used to the file.


Rm* : Remove all files.
Syntax: $rm <filename>

14
3. mv: It is used to move the file from one location to another.
Syntax: $mv [option] source destination

4. cp: It is used to copies a file to destination file.


Syntax:$cp

5. join: It is used for joining line of two files on the basis of common field in each file called
as a key.
-t : Field separator
-o : Specify the column from each table that must be included.

Syntax: $join –t”:” s1 s2

6. split: It is used to split the large file into smaller files. Default size is 1000 lines per file.
$split –n : number of lines in each smaller files.

Syntax:$split –n filename

7. cat: It is used to create the file and displaying the contents of files .
Syntax: $cat >filename

15
8. head: It is used to read the first ten lines of file. The number of lines to be displayed may
be specified in the head command.

Syntax: $head –n filename

9. tail: It is used to print last few numbers of lines of a certain file, then terminates.
+n: Displays all lines starting from nth line.
-n: Displays n lines from end of the file.
l : Indicates lines
b: Indicates blocks
c : Indicates character

16
10. touch: It is the easiest way to create new, empty file.
Syntax: $touch <filename>

17
 Directory manipulation command

1. mkdir: It is used to create a new directory in a current directory.


Syntax: $mkdir <filename>

2. cd: The cd command is used to change directory


$cd. : To come out from current working directory.
$cd.. : It change to root directory.

3. rmdir: It is used to delete/remove a directory. If the parent directory having subdirectory


then first all subdirectories will be deleted then the parent directory is deleted.

Syntax: $rmdir <filename>

4. pwd: pwd stands for Parent Working directories. It is used to see specific Unix directory
on which the user is working on.

Syntax: $pwd

18
5. diff: This command is used to show difference between two text file.
Syntax:$diff

6. comm: This command compares two sorted files. It compare each line of first file with its
corresponding line in second file and generate three column output.

Syntax: $comm file1 file2

7. pr: The pr command does minor formatting of files on the terminal screen or for a printer.
Syntax: $proption filename

8. dir: It is used to list all files and directories.

Syntax: $dir

9. chmod: Use the chmod command to change the permissions(read(4), write(2),


execute(1)) for some files. List the file before and after each change and
determine how the command changes the file permissions.

Syntax: $chmod ugo+x abc

19
10. cmp: This command is used to compare files when used without option.

Syntax: $cmp

 Text processing Command

1. tr: tr command in Unix-Like operating system. It is an abbreviation of translate or


transliterate, including its operation of replacing or removing specific characters in its
input dataset.

Syntax: $tr

2. wc: This command is used to find out number of lines, words and character in file.

Syntax: $wc

3. cut: It is used to copy the specified column to the standard output file. It is used to cut
portion of a file .

Synatx: $cut [-f/-c][n1,n2]filename

4. paste: It is used to join files horizontally by outputting lines consisting of lines from each
file specified, separated by tab as delimiter, to the standard output.

Syntax: $paste [option][file]

20
5. spell: Spell is a spell-checking program which scans a text file for misspelled word on its
own line.

Syntax: $spell [options]..files

7. sort: SORT command is used to sort a file, Arranging the records particular line.
-o : Write the output to a new line.
-n : Sort a file numerically
-r : Sort in reverse order.

Syntax: $sort

8. grep: It is used to search a pattern/word inside file.


-c : Display the count of the number of occurrences of the pattern
-l : Display the last list of the filenames which contains a pattern.
-n : Display line numbers along with the lines containing a pattern.

21
Syntax: grep –c

9. more: If the file is too large for its contents to fit in one screen, it will scroll of your
screen when the file is displayed with cat command then use more command.
j : Scroll forward one line.
f : Scroll forward one screen.
b : Scroll backward one screen.
k : Scrolls backward one line.
200G : Goes to line no. 200.
G : Goes to last line of the file.

Syntax: $more[“Space bar”]/f/b/j/k/200/G]filename

22
 Communication related Commands

1. d+iff: Mail notification.


Syntax: $diff

2. comstat : Incoming mail daemon


System: $comstat

3. Mail.rc : Configuration file for mail.


Syntax: $Mail.rc

4. wall: Send message to all users.


Syntax: $wall

5. write: Send messages to specific user.


Syntax: $write

6. mesg: allow/disallow write or talk.


Syntax: $mesg

7. ate: vt100 terminal emulator.


Syntax: $ate

8. cu: Connect to unix system


Syntax: $cu

9.uucp: Copy files to unix system


Syntax: $uucp

10. uux: Execute a command on another unix system


Syntax: $uux

11. sendmail: Deamon for sending email


Syntax: $sendmail

12. aliases : – Alternate email addresses

23
NUMERICAL:
Consider the following set of processes, with the length of the CPU burst given in
milliseconds
Process Burst Time Priority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2

Find out average waiting time by using


(i) Nonpreemptive priority
(ii) Round-Robin (RR) (quantum = 1)

i) Nonpreemptive priority
Gantt chart:

P2 P5 P1 P3 P4
0 1 6 16 18 19

Processes Arrival T. Burst T. Completion T. Turnaround T. Waiting T.


P1 0 10 16 16 6
P2 0 1 1 1 0
P3 0 2 18 18 16
P4 0 1 19 19 18
P5 0 5 6 6 1

Average Waiting Time = (6+0+16+18+1)/5


= 41/5
= 8.2 ms

ii) ) Round-Robin (RR)


Gantt chart:

P P P3 P4 P5 P1 P3 P5 P1 P5 P P5 P P5 P P1 P P1 P1
1 2 1 1 1 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Processes Arrival T. Burst T. Completion T. Turnaround T. Waiting T.
P1 0 10 19 19 9
P2 0 1 2 2 1
P3 0 2 7 7 5
P4 0 1 4 4 3
P5 0 5 14 14 9

Average Waiting Time = (9+1+5+3+9)/5


= 27/5
= 5.4 ms

24

You might also like