Docsity

“Operating System Unit-1 Notes (Complete & Easy Revision Guide)”, Study notes of Operating Systems

Toggle sidebar
bg1
UNIT 1
Introduction to Operating System
The Operating System is a program with the following features −
• An operating system is a program that acts as an interface between the software and the
computer hardware.
• It is an integrated set of specialized programs used to manage overall resources and
operations of the computer.
• It is a specialized software that controls and monitors the execution of all other programs
that reside in the computer, including application programs and other system software.
Objectives of Operating System
The objectives of the operating system are −
• To make the computer system convenient to use in an efficient manner.
• To hide the details of the hardware resources from the users.
• To provide users a convenient interface to use the computer system.
• To act as an intermediary between the hardware and its users, making it easier for the
users to access and use other resources.
• To manage the resources of a computer system.
• To keep track of who is using which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
• To provide efficient and fair sharing of resources among users and programs.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download “Operating System Unit-1 Notes (Complete & Easy Revision Guide)” and more Study notes Operating Systems in PDF only on Docsity!

UNIT 1

Introduction to Operating System

The Operating System is a program with the following features −

  • An operating system is a program that acts as an interface between the software and the computer hardware.
  • It is an integrated set of specialized programs used to manage overall resources and operations of the computer.
  • It is a specialized software that controls and monitors the execution of all other programs that reside in the computer, including application programs and other system software.

Objectives of Operating System

The objectives of the operating system are −

  • To make the computer system convenient to use in an efficient manner.
  • To hide the details of the hardware resources from the users.
  • To provide users a convenient interface to use the computer system.
  • To act as an intermediary between the hardware and its users, making it easier for the users to access and use other resources.
  • To manage the resources of a computer system.
  • To keep track of who is using which resource, granting resource requests, and mediating conflicting requests from different programs and users.
  • To provide efficient and fair sharing of resources among users and programs.

Characteristics of Operating System

Here is a list of some of the most prominent characteristic features of Operating Systems −

  • Memory Management − Keeps track of the primary memory, i.e. what part of it is in use by whom, what part is not in use, etc. and allocates the memory when a process or program requests it.
  • Processor Management − Allocates the processor (CPU) to a process and deallocates the processor when it is no longer required.
  • Device Management − Keeps track of all the devices. This is also called I/O controller that decides which process gets the device, when, and for how much time.
  • File Management − Allocates and de-allocates the resources and decides who gets the resources.
  • Security − Prevents unauthorized access to programs and data by means of passwords and other similar techniques.
  • Job Accounting − Keeps track of time and resources used by various jobs and/or users.
  • Control Over System Performance − Records delays between the request for a service and from the system.
  • Interaction with the Operators − Interaction may take place via the console of the computer in the form of instructions. The Operating System acknowledges the same, does the corresponding action, and informs the operation by a display screen.
  • Error-detecting Aids − Production of dumps, traces, error messages, and other debugging and error-detecting methods.
  • Coordination Between Other Software and Users − Coordination and assignment of compilers, interpreters, assemblers, and other software to the various users of the computer systems.

An operating system is a program that acts as an intermediate part between a user of a computer and the computer hardware and controls the execution of all kinds of programs.An operating system is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer.

Objectives of OS:

1.Convenience: An OS makes a computer more convenient to use.

2.Efficiency: An OS allows the computer system resources to be used in an efficient manner.

3.Ability to evolve: An OS should be constructed in such a way as to permit the effective development, testing, and introduction of new system functions without interfering with service.

Functions of an operating System are as follows:

Memory Management: Memory management refers to management of Primary Memory or Main Memory.An Operating System does the following activities for memory management: OS Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are not in use.In multi-programming, the OS decides which process will get memory when and how much.OS allocates the memory when a process requests it to do so. It de-allocates the memory when a process no longer needs it or has been terminated.

Processor Management: In multi-programming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling. An Operating System does the following activities for processor management: OS keeps tracks

What is Evolution of Operating Systems? Operating systems have progressed from slow and expensive systems to today's technology, which has exponentially increased computing power at comparatively modest costs. So let's have a detailed look at the evolution of operating systems. The operating system can be classified into four generations, as follows:

  • First Generation
  • Second Generation
  • Third Generation
  • Fourth Generation First Generation (1945-1955) Serial Processing The evolution of operating systems began with serial processing. It marks the start of the development of electronic computing systems as alternatives to mechanical computers. Because of the flaws in mechanical computing devices, humans' calculation speed is limited, and they are prone to making mistakes. Because there is no operating system in this generation, the computer system is given instructions that must be carried out immediately. Programmers were incorporated into hardware components without using an operating system by the 1940s and 1950s. The challenges here are scheduling and setup time. The user logs in for machine time by wasting computational time. Setup time is required when loading the compiler, saving the compiled program, the source program, linking, and buffering. The process is restarted if an intermediate error occurs. Example: Windows 95 and 98 are examples of serial processing operating systems. Second Generation (1955-1965) Batch System The batched systems marked the second generation in the evolution of operating systems. In the second generation, the batch processing system was implemented, which allows a job or task to be done in a series and then completed sequentially. The computer system in this generation does not have an operating system, although various operating system functionalities are available, such as FMS and IBSYS. It is used to improve computer utilization and application. On cards and tapes, jobs were scheduled and submitted. Then, using Job Control Language, they were successively executed on the monitors. The first computers employed in the batch operation method created a computer batch of jobs that never paused or stopped. The software is written on punch cards and then transferred to the tape's processing unit. When the computer finishes one job, it immediately moves on to the next item on the tape. Despite the fact that it is inconvenient for the users, it is designed to keep the pricey computer as busy as possible by running a leveraged stream of operations. Memory protection prevents the memory space that makes up the monitor from being changed, and the timer prevents the job from monopolizing the system. When the input and output devices are in use, the processor remains idle due to poor CPU utilization. Example: MVS Operating System of IBM is an example of a batch processing operating system. Third Generation (1965-1980) Multi-Programmed Batched System The evolution of operating systems embarks the third generation with multi-programmed batched systems. In the third generation, the operating system was designed to serve numerous users simultaneously. Interactive users can communicate with a computer via an online terminal, making the operating system multi-user and multiprogramming. It is used to execute several jobs that should be kept in the main memory. The processor determines which program to run through job scheduling algorithms. Example: Windows and IOS are examples of multi-programmed batched operating systems.

Fourth Generation (1980-Now) The operating system is employed in this age for computer networks where users are aware of the existence of computers connected to one another. The era of networked computing has already begun, and users are comforted by a Graphical User Interface (GUI), which is an incredibly comfortable graphical computer interface. In the fourth generation , the time-sharing operating system and the Macintosh operating system came into existence.

  1. Time-Sharing Operating System : The Time-sharing of operating systems had a great impact on the evolution of operating systems. Multiple users can access the system via terminals at the same time, and the processor's time is divided among them. Printing ports were required for programs having a command-line user interface, which required written responses to prompts or written commands. The interaction is scrolled down like a roll of paper. It was previously used to develop batch replacement systems. The user interfaces directly with the computer via printing ports, much like an electric teletype. Few users shared the computer immediately, and each activity was completed in a fraction of a second before moving on to the next. By establishing iterations when they are receiving full attention, the fast server may act on a large number of users' processes at once. Multiple programs use time-sharing systems to apply to the computer system by sharing the system interactively.

Example: Unix Operating System is an example of a time-sharing OS.

  1. Macintosh Operating System : It was based on decades of research into graphical operating systems and applications for personal computers. The photo depicts a Sutherland pioneer program sketchpad that was developed in 1960, employing many of the characteristics of today's graphical user interface, but the hardware components cost millions of dollars and took up a room. The initiative on massive computers and hardware improvements made the Macintosh commercially and economically viable after many research gaps. Many research laboratories are still working on research prototypes like sketchpads. It served as the foundation for anticipated products.

Example: Mac OS X 10.6.8 snow leopard and OS X 10.7.5 Lion are some examples of macintosh OS.

  • The interface between the user and the computer system is known as an operating system.
  • The history of the operating system has 4 generations.
  • The first generation (1945-1955) only had computer systems that were used to perform simple mathematical operations and also electronic computers were introduced during the 1940s.
  • The second generation (1955-1965) introduced the concept of a Batch operating system.
  • In the third generation (1965-1980), multiprogramming was introduced where multiple tasks could be performed on a single operating system.
  • In the fourth generation (1980-now) different operating systems like Windows OS and macOS were introduced.
  • The operating system helps in regulating and monitor the device, creating an interface between the hardware and the user.
  1. First Generation. The first generation of the operating system was used in the year 1945 to 1955 during the time of electronic computing systems development. It was the era of mechanical computing systems where the users or the programmers used to provide the instructions ( through punch cards, paper tape, magnetic tape, etc .) and the computer had to follow them. Now, due to human intervention, the process was very slow and there were chances of human mistakes.

We can say that there is no operating system at that time and users used to give programs to the computer system itself. So, less speed and more errors were the first-generation operating systems' drawbacks.

  1. Second Generation. The second generation of the operating system was used from the year 1955 to 1965 during the time of batch operating system development.

During the second generation phase, the users used to prepare their instructions (tasks or jobs) in the form of jobs on an off-line device like punch cards and submit them to the computer operator. Now, out of these punch cards (these punch cards were tabulated into instructions for computers), similar punch cards of jobs were grouped and run as a group to speed up the entire process. The jobs consisted of program and input data along with the control instructions. The main task of the programmer or developer was to create jobs or programs and then hand them over to the operator in the form of punch cards. Now, it was the duty of an operator to sort the programs with similar requirements into batches.

Some major drawbacks of the second-generation operating system were:

  • We could not set the priority of the jobs as jobs were scheduled only basis of similarities among the jobs.
  • The CPU was not utilized to its max potential as the CPU becomes idle (when the operator was loading jobs).
  1. Third Generation. The third generation of the operating system was used in the year 1965 to 1980 during the time of multiprogramming operating system development. The third generation operating system was developed to serve more than one user at a time (multi-users). During this period, users were able to communicate with the operating systems with the help of software called command-line interface. So, the computers became multi-user and multiprogramming.
  2. Fourth Generation. The fourth generation of the operating system is being in from the year 1980 till now. Before the evolution of the fourth generation of the operating system, the users were able to communicate with the operating system but with the help

a. Serial Processing

Before the 1950 � 1950 s , there was no operating system, and users used to give programs to the computer system itself. So, less speed and more errors were generated (as serial processing is done on a single machine). So, the developers or the programmers had to provide the entire program in the form of sequential instruction in the form of a punched card. These punched cards were first translated into a card reader and then it was submitted to the operating system.

Due to this extensive process of execution of a simple program and human intervention, the overall execution time was very large and inefficient. There were various other problems such as no user interaction, execution of only one process at a time, very less memory, no error handling, etc. Now, a red light was used to detect the error in the program execution. So, if there was any error, the error got detected due to red blinking lights.

The major drawbacks of the serial operating system were:

  • No user and computer system interaction.
  • Very less memory.
  • It required a lot of time for program execution.
  • Only one program could be executed at a time.
  • the user could not execute another program when one program was in execution.

b. Batch Processing

In today's world, we can see that a user of the computer directly interacts with the computer. But in the past years (1955 - 1965), the users were not able to directly interact with the computer system.

In earlier times, we used a type of operating system termed a batch operating system in which the user(s) used to prepare their instructions (tasks or jobs) in the form of jobs on an off-line device like punch cards and submits them to the computer operator. Now, out of these punch cards, similar punch cards of jobs were grouped and run as a group to speed up the entire process.

Note: The Jobs consisted of program and input data along with the control instructions.

The main task of the programmer or developer was to create jobs or programs and then hand them over to the operator in the form of punch cards. Now, it was the duty of an operator to sort the programs with similar requirements into batches. Due to this dual procedure and manual intervention , the batch operating system was a slow operating system. The most common use input and output devices were card-reader or tape drives.

The Batch operating system was used to schedule similar jobs in one batch, so the same jobs in the batch were executed at a higher speed. As the jobs were scheduled one after the other, whenever a job gets completed, the next job from the job spool gets executed without any user interaction. The batch operating system also eliminates the setup time issue.

d. Time-sharing System

In the time-sharing operating system, several jobs or processes can be loaded into the main memory simultaneously and several users can share the system as well. We can hence, say that the time-sharing operating system was a logical extension of the multiprogramming operating system. The name time-sharing was used because the processes used to share an equal amount of time specified by the operating system developer.

The main aim of the time-sharing operating system was to reduce the overall process response time. The CPU could execute several processes by providing an equal amount of time to each process, so the CPU utilization became better than the multiprogramming operating system.

Note:

  • Response time is the total amount of time it takes to respond to a process. It should not be confused with the execution time. The switching between several operating system processes was handled by an operating system subprocess knew as the CPU scheduler.

The benefits of the time-sharing operating system are :

  • Multiple processes and user requests can be responded to simultaneously as there is more than one processing unit.
  • Better response time than the previously used multiprogramming operating system.
  • The CPU did not have to be idle due to regular switching.
  • More efficient utilization of the CPU.

e. Parallel Processing System

In the parallel processing operating system, there we more than one processor. So, several jobs or processes can be loaded into the main memory simultaneously and all the processors work concurrently on these processes. In a parallel processing operating system, a process is divided into several sub-processes (also known as threads), and these threads are distributed for execution among the various processors that are present in the system. There is multiprogramming.

So, the parallel processing finishes the job in lesser time. Now, as multiple processors execute the job in a parallel manner, this system was termed a parallel processing operating system.

The benefits of a parallel processing operating system are:

  • Due to multiple processors, a process was executed even faster than the time-sharing operating system.
  • If one of the processors failed then the other processors were able to execute the process so there was very less chance of failure.
  • The delay in the processing of data was reduced to much extent.
  • After that, users were able to communicate with the operating systems with the help of software called terminal. Nowadays, with the development of Graphical User Interface, the user experience is more convenient.
  • Several processes can be loaded into the main memory simultaneously with the help of a single processor in the multiprocessor operating system.
  • In a time-sharing system, processes are used to share an equal amount of time specified by the operating system developer.
  • In a parallel processing operating system, there we more than one processor. Hence several processes can be loaded into the main memory simultaneously and all the processors work concurrently on these processes.
  • In the distributed operating system, two or more nodes are connected. Various nodes are connected, but the memory or a clock is not shared by the processors.

https://www.scaler.com/topics/evolution-of-operating-system/

For challenge

Process in Operating System

A process is a program in execution which then forms the basis of all computation. The process is not as same as program code but a lot more than it. A process is an 'active' entity as opposed to the program which is considered to be a 'passive' entity. Attributes held by the process include hardware state, memory, CPU, etc.

Process memory is divided into four sections for efficient working :

  • The Text section is made up of the compiled program code, read in from non-volatile storage when the program is launched.
  • The Data section is made up of the global and static variables, allocated and initialized prior to executing the main.
  • The Heap is used for the dynamic memory allocation and is managed via calls to new, delete, malloc, free, etc.
  • The Stack is used for local variables. Space on the stack is reserved for local variables when they are declared.

File

A file is a named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes, lines or records whose meaning is defined by the files creator and user.

File Structure

A File Structure should be according to a required format that the operating system can understand.

  • A file has a certain defined structure according to its type.
  • A text file is a sequence of characters organized into lines.
  • A source file is a sequence of procedures and functions.
  • An object file is a sequence of bytes organized into blocks that are understandable by the machine.
  • When operating system defines different file structures, it also contains the code to support these file structure. Unix, MS-DOS support minimum number of file structure. File Type

File type refers to the ability of the operating system to distinguish different types of file such as text files source files and binary files etc. Many operating systems support many types of files. Operating system like MS-DOS and UNIX have the following types of files −

Ordinary files

  • These are the files that contain user information.
  • These may have text, databases or executable program.
  • The user can apply various operations on such files like add, modify, delete or even remove the entire file. Directory files
  • These files contain list of file names and other information related to these files. Special files
  • These files are also known as device files.
  • These files represent physical device like disks, terminals, printers, networks, tape drive etc.

Indexed Allocation

  • Provides solutions to problems of contiguous and linked allocation.
  • A index block is created having all pointers to files.
  • Each file has its own index block which stores the addresses of disk space occupied by the file.
  • Directory contains the addresses of index blocks of files.

What is System Call in Operating System?

A system call is a mechanism that provides the interface between a process and the operating system. It is a programmatic method in which a computer program requests a service from the kernel of the OS.

System call offers the services of the operating system to the user programs via API (Application Programming Interface). System calls are the only entry points for the kernel system.

Example of System Call

For example if we need to write a program code to read data from one file, copy that data into another file. The first information that the program requires is the name of the two files, the input and output files.

In an interactive system, this type of program execution requires some system calls by OS.

  • First call is to write a prompting message on the screen
  • Second, to read from the keyboard, the characters which define the two files.

How System Call Works?

Here are the steps for System Call in OS:

As you can see in the above-given System Call example diagram.

Step 1) The processes executed in the user mode till the time a system call interrupts it.

Step 2) After that, the system call is executed in the kernel-mode on a priority basis.

Step 3) Once system call execution is over, control returns to the user mode.,

Step 4) The execution of user processes resumed in Kernel mode.

Why do you need System Calls in OS?

Following are situations which need system calls in OS:

  • Reading and writing from files demand system calls.
  • If a file system wants to create or delete files, system calls are required.
  • System calls are used for the creation and management of new processes.
  • Network connections need system calls for sending and receiving packets.
  • Access to hardware devices like scanner, printer, need a system call.