Operating System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 117

Vivekananda Institute of Professional Studies

Unit-1
Evolution of OS

Ms. Swati Jain, Assistant


Professor, VSIT, VIPS

1
Swati Jain, Assistant
Professor, VIPS
What is an Operating System?

Ø A program that acts as an intermediary between a user of


a computer and the computer hardware
Ø Operating system goals:
z Execute user programs and make solving user problems
easier.
z Make the computer system convenient to use
Ø Use the computer hardware in an efficient manner

Swati Jain, Assistant


Professor, VIPS
Computer System Components
1. Hardware - provides basic computing resources (CPU, memory,
I/O devices)
2. Operating system - controls and coordinates the use of the
hardware among the various application programs for the various
users
3. Applications programs - define the ways in which the system
resources are used to solve the computing problems of the users
(compilers, database systems, video games, business programs)
4. Users (people, machines, other computers)

Swati Jain, Assistant


Professor, VIPS
Abstract View of System Components

Swati Jain, Assistant


Professor, VIPS
More Operating System Definitions

Ø Resourceallocator -
manages and allocates resources
ØControl program -
Øcontrols the execution of user programs and
operations of I/O devices
ØKernel -
the one program running at all times (all else being
application programs)

Swati Jain, Assistant


Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
 Some computer systems only did one thing at a time. They had a list of
the computer programs and system may be dedicated to a single
program until its completion, or they may be dynamically reassigned
among a collection of active programs in different stages of execution.
 Batch operating system is one where programs and data are collected
together in a batch before processing starts. A job is predefined
sequence of commands, programs and data that are combined in to a
single unit called job.
 Fig. 1 shows the memory layout for a simple batch system. Memory
management in batch system is very simple. Memory is usually divided
into two areas : Operating system and user program area.
 Scheduling is also simple in batch system. Jobs are processed in the
order of submission i.e first come first served fashion.

Fig 1 Memory Layout for a Simple Batch System

Swati Jain, Assistant


Professor, VIPS
 When job completed execution, its memory is released and the output for the job
gets copied into an output spool for later printing.
 Batch system often provides simple forms of file management. Access to file is
serial. Batch systems do not require any time critical device management.
 Batch systems are inconvenient for users because users can not interact with their
jobs to fix problems. There may also be long turn around times. Example of this
system is generating monthly bank statement.
 Advantages of Batch System
 Move much of the work of the operator to the computer.
 Increased performance since it was possible for job to start as soon as the
previous job finished.
 Disadvantages of Batch System
 Turn around time can be large from user standpoint.
 Difficult to debug program.
 A job could enter an infinite loop.
 A job could corrupt the monitor, thus affecting pending jobs.
 Due to lack of protection scheme, one batch job can affect pending jobs.

Swati Jain, Assistant


Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
• Two or more programs in memory at the same time, sharing the processor is referred to
the multiprogramming operating system. Multiprogramming system has a single
processor that is being shared
• It increases CPU utilization by organizing jobs so that the CPU always has one to execute.
• The operating system keeps several jobs in memory at a time. This set of jobs is a subset
of the jobs kept in the job pool. The operating system picks and begins to execute one of
the job in the memory.
• Multi-programmed system provide an environment in which the various system
resources are utilized effectively, but they do not provide for user interaction with the
computer system.
• Jobs entering into the system are kept into the memory. Operating system picks the job
and begins to execute one of the job in the memory. Having several programs in memory
at the same time requires some form of memory management.
• Multiprogramming operating system monitors the state of all active programs and
system resources. This ensures that the CPU is never idle unless there are no jobs
• Advantages
• 1. High CPU utilization.
• 2. It appears that many programs are allotted CPU almost simultaneously.
• Disadvantages
• 1. CPU scheduling is required.
• 2. To accommodate many jobs in memory, memory management is required.

Swati Jain, Assistant Professor, VIPS


Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
• Multi-programmed batched systems provide an environment where
the various system resources (for example, CPU, memory, peripheral
devices) are utilized effectively.
• Time sharing, or multitasking, is a logical extension of
multiprogramming. Multiple jobs are executed by the CPU switching
between them, but the switches occur so frequently that the users
may interact with each program while it is running.
• An interactive, or hands-on, computer system provides on- line
communication between the user and the system. The user gives
instructions to the operating system or to a program directly, and
receives an immediate response. Usually, a keyboard is used to
provide input, and a display screen (such as a cathode-ray tube
(CRT) or monitor) is used to provide output.
• If users are to be able to access both data and code conveniently, an
on-line file system must be available. A file is a collection of related
information defined by its creator. Batch systems are appropriate for
executing large jobs that need little interaction.

Swati Jain, Assistant


Professor, VIPS
• Time-sharing systems were developed to provide interactive use of a
computer system at a reasonable cost. A time- shared operating system
uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time-shared computer. Each user has at least one
separate program in memory. A program that is loaded into memory and
is executing is commonly referred to as a process. When a process
executes, it typically executes for only a short time before it either
finishes or needs to perform I/O. I/O may be interactive; that is, output is
to a display for the user and input is from a user keyboard. Since
interactive I/O typically runs at people speeds, it may take a long time to
completed.
• A time-shared operating system allows the many users to share the
computer 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 she has her own computer, whereas actually
one computer is being shared among many users.
• Time-sharing operating systems are even more complex than are multi-
programmed operating systems. As in multiprogramming, several jobs
must be kept simultaneously in memory, which requires some form of
memory management and protection. Swati Jain, Assistant
Professor, VIPS
Swati Jain, Assistant
Professor, VIPS
Distributed Systems

„ Distribute the computation among several physical


processors
„ Loosely coupled system - each processor has its own
local memory; processors communicate with one another through various communications
lines, such as high- speed buses or telephone lines
Requires networking infrastructure
Local area networks (LAN) or Wide area networks (WAN)
May be either client-server or peer-to-peer systems
„ Advantages of distributed systems
z Resources Sharing
z Computation speed up - load sharing
z Reliability
z Communications

Swati Jain, Assistant


Professor, VIPS
 1. Batch : Jobs with similar needs are batched together and run through the computer as a
group by an operator or automatic job sequencer. Performance is increased by attempting to
keep CPU and I/O devices busy at all times through buffering , off line operation, spooling and
multiprogramming. A Batch system is good for executing large jobs that need little interaction,
it can be submitted and picked up latter.
 2. Time sharing : Uses CPU scheduling and multiprogramming to provide economical &
interactive use of a system. The CPU switches rapidly from one user to another i.e. the CPU is
shared between a number of interactive users. Instead of having a job defined by spooled card
images, each program reads its next control instructions from the terminal and output is
normally printed immediately on the screen.
 3. Interactive : User is on line with computer system and interacts with it via an interface. It is
typically composed of many short transactions where the result of the next transaction may be
unpredictable. Response time needs to be short since the user submits and waits for the result.
 4. Real time system : Real time systems are usually dedicated, embedded systems. They
typically read from and react to sensor data. The system must guarantee response to events
within fixed periods of time to ensure correct performance.
 5. Distributed : Distributes computation among several physical processors. The processors
do not share memory or a clock. Instead, each processor has its own local memory. They
communicate with each other through various communication lines

Swati Jain, Assistant


Professor, VIPS
 SPOOL is an acronym for simultaneous peripheral operations on-line.
 It is a kind of buffering mechanism or a process in which data is temporarily
held to be used and executed by a device, program or the system. Data is
sent to and stored in memory or other volatile storage until the program or
computer requests it for execution.
 In a computer system peripheral equipment, such as printers and punch
card readers, etc. (batch processing), are very slow relative to the
performance of the rest of the system. Getting input and output from the
system was quickly seen to be a bottleneck. Here comes the need for spool.
 Spooling works like a typical request queue where data, instructions and
processes from multiple sources are accumulated for execution later on.
Generally, it is maintained on computer’s physical memory, buffers or the
I/O device-specific interrupts. The spool is processed in FIFO manner i.e.
whatever first instruction is there in the queue will be popped and executed.

Swati Jain, Assistant


Professor, VIPS
 1) The most common can be found in I/O devices like keyboard printers and
mouse. For example, In printer, the documents/files that are sent to the printer
are first stored in the memory or the printer spooler. Once the printer is ready, it
fetches the data from the spool and prints it.
 Even experienced a situation when suddenly for some seconds your mouse or
keyboard stops working? Meanwhile, we usually click again and again here and
there on the screen to check if its working or not. When it actually starts working,
what and wherever we pressed during its hang state gets executed very fast
because all the instructions got stored in the respective device’s spool.
 2) A batch processing system uses spooling to maintain a queue of ready-to-run
jobs which can be started as soon as the system has the resources to process
them.
 3) Spooling is capable of overlapping I/O operation for one job with processor
operations for another job. i.e. multiple processes can write documents to a print
queue without waiting and resume with their work.
 4) E-mail: an email is delivered by a MTA (Mail Transfer Agent) to a temporary
storage area where it waits to be picked up by the MA (Mail User Agent)

Swati Jain, Assistant


Professor, VIPS
“Linux at the Command Line”
What is
Linux?

It’s an
Operating
System
 Linux is a Unix clone written from scratch by
Linus Torvalds with assistance from a
loosely-knit team of hackers across the Net.
 Unix is a multitasking, multi-user computer
operating system originally developed in
1969 by a group of AT&T employees at Bell
Labs.
 Linux and Unix strive to be POSIX compliant.
 64% of the world’s servers run some variant
of Unix or Linux. The Android phone and the
Kindle run Linux.
 The Linux directory structure is like a tree. The base of the Linux file system hierarchy
begins at the root. Directories branch off the root, but everything starts at root.

 The directory separator in Linux is the forward slash (/). When talking about
directories and speaking directory paths, “forward slash” is abbreviated to “slash.”
Often the root of the file system is referred to as “slash” since the full path to it is /. If
you hear someone say “look in slash” or “that file is in slash,” they are referring to the
root directory.

 The /bin directory is where you will find binary or executable files. Programs are
written in source code which is human readable text. Source code is then compiled
into machine readable binaries. They are called binaries because machine code is a
series of zeros and ones. The import thing to know is that commands, programs, and
applications that you can use are sometimes located in /bin.

 Configuration files live in the /etc directory. Configuration files control how the
operating system or applications behave. For example, there is a file in /etc that tells
the operating system whether to boot into a text mode or a graphical mode.
 User home directories are located in /home. If your account name is “pat” your home
directory will be /home/pat. Linux systems can and often do have multiple user accounts.
Home directories allow each user to separate their data from the other users on the system.
The pat directory is knows as a subdirectory. A subdirectory is simply a directory that
resides inside another directory.

 The /opt directory houses optional or third party software. Software that is not bundled
with the operating system will often been installed in /opt. For example, the Google Earth
application is not part of the standard Linux operating system and gets installed in the
/opt/google/earth directory.

 Temporary space is allocated in /tmp. Most Linux distributions clear the contents of /tmp at
boot time. Be aware that if you put files in /tmp and the Linux system reboots, your files
will more than likely be gone. The /tmp directory is a great place to store temporary files,
but do not put anything in /tmp that you want to keep long term.

 The /usr directory is called “user.” You will find user related binary programs and
executables in the /usr/bin directory.

 Variable data such as log files reside in /var. Specifically, the /var/log directory contains
logs generated by the operating system and other applications.
 Linux commands are an essential part of managing and operating Linux
systems, providing users with the ability to perform a wide range of
tasks from file manipulation to system monitoring.
 These commands can be categorized into two types: internal and
external commands.
 Internal commands are built into the shell itself, enabling quick
execution without the need for external binaries.
 In contrast, external commands are separate executable files located in
the system’s file hierarchy.
 To determine whether a command is internal or external, you can use
the type command. The type command provides information about how
a command name is interpreted. Here is how you can use it:
 type command_name
 For example:

 $ type cd
 This will output: cd is a shell builtin. Indicating that cd is an internal
command.

 $ type ls
 This will output: ls is hashed (/usr/bin/ls). Indicating that ls is an
external command located in the /bin directory.
 The “man” command, short for manual, is a powerful tool in the Linux operating system
that allows users to access detailed information about various commands, utilities, and
system calls.
 The “man” command provides comprehensive documentation, helping users understand
how to use and configure different elements of the Linux environment.
 When you type man followed by a command name, it retrieves and displays the manual
page for that command, offering comprehensive details on how to use it, including all
available options and flags. This command is crucial for learning about the tools and
commands available in the Linux operating system.

For example: To view the manual for the “ls” command execute the following command:man ls
•This will display detailed information about the “ls” command, including its usage, options, and
examples.
 Some commands don't have man pages or have incomplete man pages and
store their information as document form. To view these pages info command
is used.

 Command info display information in the document format. It is similar to man


command with more robustness for linking pages together.

 Info pages are made with texinfo tools, can link with other pages and create
menus.

 The info document's default location is /usr/share/info.


 help command displays information about shell built-in commands.
 // syntax for help command

 $help [-dms] [pattern ...]


 The pattern specified in the syntax above refers to the command about which you would
like to know and if it is matched with any shell built-in command then help give details
about it and if it is not matched then help prints the list of help topics for your
convenience. And the d, m and s here are options that you can use with the help
command.
 help is a built-in command in the bash shell (and that shell only)
that documents some of the builtin commands and keywords of
that shell. That’s an internal documentation system of that shell.
Other shells have their own documentation system ( ksh93 has -
-help and --man options for its builtins, zsh has a run-help
helper that extracts information from manuals in other formats).
Other commands like vim have their own embedded
documentation system.

 man is a system-wide documentation system that provides short


reference manuals (pages) for individual commands, API
functions, concepts, configuration file syntax, file formats
organised in sections (1 for user commands, 2 for system calls…).
That’s the traditional Unix documentation system.
Basic Linux Commands for Directories and Files

Directory Commands
Basic Linux Commands for Directories and Files

File Commands
Basic Linux Commands for Directories and Files
Other Commands
 The default editor that comes with the
Linux/UNIX operating system is called vi
(visual editor).
 Using vi editor, we can edit an existing file or
create a new file from scratch. we can also use
this editor to just read a text file.
 The advanced version of the vi editor is the
vim editor.
 There are three modes of operation in vi:
• Shell is a command-line interpreter that allows the user to
interact with the system.

• It is responsible for taking inputs from the user and displaying


the output.

• Shell scripts are a series of commands written in order of


execution.

• These scripts can contain functions, loops, commands, and


variables. Scripts are useful for simplifying a complex series of
commands and repetitive tasks.
• A shell script needs to be saved with the extension .sh.

• The file needs to begin with the shebang line (#!) to let the Linux
system know which interpreter to use for the shell script.

• For environments that support bash, use:

#!/bin/bash

• For environments that support shell, use:

#!/bin/sh

This tutorial assumes that your environment supports bash.


• Creating and Running a Basic Shell Script
• vi basic_script.sh

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy