OS Chapter 1 Notes
OS Chapter 1 Notes
Objectives
❖ To study basic fundamentals of operating system.
❖ To understand concept of Linux operating system
❖ To learn basic commands of Linux operating system
Introduction to operating system
❖ Operating system acts as an intermediary between the
user of computer and computer hardware.
❖ The purpose of an OS is to provide an environment in
which a user can execute programs in a convenient
and efficient manner.
❖ An OS is a program which manages all the computer
hardware.
List off Different services provided by operating system to
users
❖ User Interface: comes with three forms…
o Command line interface
o Batch based interface
o Graphical user interface
❖ Program execution :
o OS must have the capability to load a program into memory and execute that
program.
o Programs must be able to end its execution, either normally or abnormally.
❖ File system manipulation:
o Programs need has to be read and then write them as files and directories.
❖ Input/output operations:
List off Different services provided by operating system to
users
❖ Input/output operations:
o A program which is currently executing may require I/O, which may involve file or
other I/O devices . for efficiency and protection users cannot directly govern the
I/O device.
❖ Communication:
❖ Process needs to swap over information with other process, processes executing
on same computer system or on different computer systems can communicate
using operating system.
❖ Communication between two processes can be done using shared memory or via
message passing.
❖ Resource allocation:-
o When multiple jobs running concurrently , resources must need to be allocated
to each of them.
o Resources can be CPU cycles, main memory storage , file storage and I/O devices
List off Different services provided by operating system to
users
❖ Error Detection:-
o Error may occur within CPU, memory hardware , I/O devices and in the user
program.
❖ Accounting :-
o This service of the operating system keeps track of which users are using how
much and what kinds of computer resources have been used for accounting or
simply to accumulate usage statistics.
❖ Security and protection:-
o Protection includes in ensuring all access to system resources in a controlled
manner. For making a system secure, the user needs to authenticate him or her
to the system before using via login ID and Password.
Introduce the concept of process
❖ A process refers to a program in execution; it’s a running instance of
a program.
❖ It is made up of the program instruction , data read from files other
programs input from a system user.
❖ A program is a passive entity such as content of a file or instruction
code of particular files whereas process is an active entity. Which
specify next instruction to execute and set if associated resources.
❖ There are two different types of process
❖ Foreground process
❖ Background process
Introduce the concept of process
❖ Background process:- a back ground process runs without being
connected to your keyboard.
❖ If the background process require any keyboard input …. It waits.
❖ The advantages of running a process in the background is that you can
run other commands….you do not have to wait until it completes to
start another.
❖ The simplest way to start a background process is to add an
ampersand (&) at the end of the command.
❖ $ls ch*.doc & amp;
❖ This display all those files the names of which start with ch and end
with .doc
Introduce the concept of process
❖ That first line contains information about the background process---
the job number and the process ID.
Process States
❖ A process which is executed by the process have various states, the
state of the process is also called as status of the process.
❖ The status includes whether the process has executed or whether the
process is waiting for some input and output from the user and
whether the process is waiting for some input and output from the
user and whether the process is waiting for the CPU to Run the
program after the completion of the process.
Process States
Process States
❖ New(Create):- the process is about to be created but not yet created.
❖ It is the program which is present in secondary memory that will be
picked up by OS to create the process.
❖ Ready:- new-> Ready to run .
❖ After the creation of a process, the process enters the ready state. i.e.
the process is loaded into main memory.
❖ Run: the process is chosen by CPU for execution and the instructions
within the process are executed by any one of the available CPU cores.
❖ Blocked or Wait:- whenever the process requests access to I/O or
needs input from the user or needs access to a critical region it
enters the blocked or wait state.
Process States
❖ Terminated or Completed : process is killed as well as PCB is deleted.
❖ Suspend ready :- process that was initially in the ready state but were
swapped out of main memory and placed onto external storage by
schedular are said to be in suspend ready state.
❖ Suspend wait or suspend blocked:- similar to suspend ready but uses
the process which was performing I/O operation and lack of main
memory caused them to move to secondary memory.
Process Control Block
❖ Process control block is data structure that contains information of
the process related to it.
❖ The process control block is also known as a task control block, entry
of the process table, etc….
❖ It is very important for process management as the data structuring
for process is done in terms of the PCB..
❖ It also defines the current state of the operating system.
❖ PCB in an operating system, is the data structure used to store the
process information . It is called…
❖ Task controlling Block
❖ Process table
Structure of the process control block
❖ The process control stores many data items that are needed for
efficient process management.
❖ Some of these data items are explained with the help of the given
diagram.
Process Control Block
Pointer: It is a stack pointer that is required to be saved when the process is switched
from one state to another to retain the current position of the process.
Process state: It stores the respective state of the process.
Process number: Every process is assigned a unique id known as process ID or PID
which stores the process identifier.
Program counter: It stores the counter,: which contains the address of the next
instruction that is to be executed for the process.
Register: These are the CPU registers which include the accumulator, base, registers,
and general-purpose registers.
Memory limits: This field contains the information about memory management
system used by the operating system. This may include page tables, segment tables,
etc.
Open files list : This information includes the list of files opened for a process.
User Interface
❖ Almost all operating system have user interface …..(UI)
❖ Operating system have two types :- command line interface (CLF) and Graphical
user interface(GUI)
❖ The command line interface (CLI) , is a non-graphical , text-based interface to the
computer system where the user types in command and the computer then
successfully executes it.
❖ The CLI terminal accepts the commands that the user types and passes to the
shell.
❖ If the output is produced by the specific command, then this text is displayed in
the terminal.
Command interpreter does the following
❖ Read the commands and any options and arguments that you
provide.
❖ Translate or expands any special characters such as the * and
? Used as wild card characters on linux and unix systems.
❖ Locates the command that you want to execute on your
system
❖ On linux command and unix , a command interpreter is known
as a shell….
Graphical user Interface
❖ Device Management :
❖ Device management does the job of device manipulation like reading
from device buffers, writing into device buffers, etc. The Linux System
calls under this is ioctl().
❖ ioctl():
❖ ioctl() is referred to as Input and Output Control.
❖ ioctl is a system call for device-specific input/output
operations and other operations which cannot be
expressed by regular system calls
•.
Types of System calls
❖ Information maintenance:
❖ These system calls handle information and its transfer
between the operating system and the user program
❖ Communication:
❖ These system calls are useful for interposes communication
. They also deal with creating and deleting a
communication connection.
FEATURES OF LINUX
❖ Basics of Linux:-
❖ Linux is a free version of unix. The free part is not meat in money
terms but rather that the source code for linux is freely available
for inspection and modification.
❖ Linux is a multitask and multiuser operating system.
❖ A multitask OS is capable of doing several tasked at the same time.
❖ A multiuser OS is a computer system that allow multiple users that
are on different computer to access single systems as resources
simultaneously.
THE LOGIN PROMPT
❖ Linux commands:
o File management and viewing
o File system management
o Network management
o System management
o Printing and programming
o Process managenment
Command structure
❖ Commands [options][parameters]
o Multiple commands separated by ; can been executed one after the
other .
o There can be more than one option and parameter for single
command.
o For instance we used a cd…. Command to go to previous directory.
o Dots …… are nothing more than parameters.
o Lets see what parameters we have with ls commands