UNIT 2
- What is operating system and explain its features?
An Operating system (OS) is software which acts as an interface between the end user and computer hardware. Every computer must have at least one OS to run other programs. An application likes Chrome, MS Word, Games, etc needs some environment in which it will run and perform its task. The OS helps you to communicate with the computer without knowing how to speak the computer's language. It is not possible for the user to use any computer or mobile device without having an operating system.
Introduction Operating System
History of OS
- Operating systems were first developed in the late 1950s to manage tape storage
- The General Motors Research Lab implemented the first OS in the early 1950s for their IBM 701
- In the mid-1960s, operating systems started to use disks
- In the late 1960s, the first version of the Unix OS was developed
- The first OS built by Microsoft was DOS. It was built in 1981 by purchasing the 86-DOS software from a Seattle company
- The present-day popular OS Windows first came to existence in 1985 when a GUI was created and paired with MS-DOS.
Features of Operating System
Here is a list commonly found important features of an Operating System:
- Protected and supervisor mode
- Allows disk access and file systems Device drivers Networking Security
- Program Execution
- Memory management Virtual Memory Multitasking
- Handling I/O operations
- Manipulation of the file system
- Error Detection and handling
- Resource allocation
- Information and Resource Protection
2. What is a Kernel in operating system explain?
The kernel is the central component of a computer operating systems. The only job performed by the kernel is to the manage the communication between the software and the hardware. A Kernel is at the nucleus of a computer. It makes the communication between the hardware and software possible. While the Kernel is the innermost part of an operating system, a shell is the outermost one.
Features of Kennel
- Low-level scheduling of processes
- Inter-process communication
- Process synchronization
- Context switching
Types of Kernels
There are many types of kernels that exists, but among them, the two most popular kernels are:
1. Monolithic
A monolithic kernel is a single code or block of the program. It provides all the required services offered by the operating system. It is a simplistic design which creates a distinct communication layer between the hardware and software.
2. Microkernels
Microkernel manages all system resources. In this type of kernel, services are implemented in different address space. The user services are stored in user address space, and kernel services are stored under kernel address space. So, it helps to reduce the size of both the kernel and operating system.
3. What are the Functions of an Operating System?
Function of an Operating System
In an operating system software performs each of the function:
- Process management:- Process management helps OS to create and delete processes. It also provides mechanisms for synchronization and communication among processes.
2. Memory management:- Memory management module performs the task of allocation and de-allocation of memory space to programs in need of this resources.
3. File management:- It manages all the file-related activities such as organization storage, retrieval, naming, sharing, and protection of files.
4. Device Management: Device management keeps tracks of all devices. This module also responsible for this task is known as the I/O controller. It also performs the task of allocation and de-allocation of the devices.
5. I/O System Management: One of the main objects of any OS is to hide the peculiarities of that hardware devices from the user.
6. Secondary-Storage Management: Systems have several levels of storage which includes primary storage, secondary storage, and cache storage. Instructions and data must be stored in primary storage or cache so that a running program can reference it.
7. Security:- Security module protects the data and information of a computer system against malware threat and authorized access.
8. Command interpretation: This module is interpreting commands given by the and acting system resources to process that commands.
9. Networking: A distributed system is a group of processors which do not share memory, hardware devices, or a clock. The processors communicate with one another through the network.
10. Job accounting: Keeping track of time & resource used by various job and users.
11. Communication management: Coordination and assignment of compilers, interpreters, and another software resource of the various users of the computer systems.
4. What are the different types of an operating system?
Types of Operating system
- Batch Operating System
- Multitasking/Time Sharing OS
- Multiprocessing OS
- Real Time OS
- Distributed OS
- Network OS
- Mobile OS
Batch Operating System
Some computer processes are very lengthy and time-consuming. To speed the same process, a job with a similar type of needs are batched together and run as a group.
The user of a batch operating system never directly interacts with the computer. In this type of OS, every user prepares his or her job on an offline device like a punch card and submit it to the computer operator.
Multi-Tasking/Time-sharing Operating systems
Time-sharing operating system enables people located at a different terminal(shell) to use a single computer system at the same time. The processor time (CPU) which is shared among multiple users is termed as time sharing.
Real time OS
A real time operating system time interval to process and respond to inputs is very small. Examples: Military Software Systems, Space Software Systems.
Distributed Operating System
Distributed systems use many processors located in different machines to provide very fast computation to its users.
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.
Mobile OS
Mobile operating systems are those OS which is especially that are designed to power smartphones, tablets, and wearables devices.
Some most famous mobile operating systems are Android and iOS, but others include BlackBerry, Web, and watchOS.
5. What are the advantages and disadvantages of operating system?
The advantage of using Operating System
- Allows you to hide details of hardware by creating an abstraction
- Easy to use with a GUI
- Offers an environment in which a user may execute programs/applications
- The operating system must make sure that the computer system convenient to use
- Operating System acts as an intermediary among applications and the hardware components
- It provides the computer system resources with easy to use format
- Acts as an intermediator between all hardware's and software's of the system
Disadvantages of using Operating System
- If any issue occurs in OS, you may lose all the contents which have been stored in your system
- Operating system's software is quite expensive for small size organization which adds burden on them. Example Windows
- It is never entirely secure as a threat can occur at any time
Summary
- An operating system is a software which acts as an interface between the end user and computer hardware
- Operating systems were first developed in the late 1950s to manage tape storage
- The kernel is the central component of a computer operating systems. The only job performed by the kernel is to the manage the communication between the software and the hardware
- Two most popular kernels are Monolithic and MicroKernels
- Process, Device, File, I/O, Secondary-Storage, Memory management are various functions of an Operating System
- Batch, Multitasking/Time Sharing, Multiprocessing, Real Time, Distributed, Network, Mobile are various types of Operating Systems
6. Explain Simple Batch System of an opearing system
In batch operating system,
- Firstly, user prepares his job using punch cards.
- Then, he submits the job to the computer operator.
- Operator collects the jobs from different users and sort the jobs into batches with similar needs.
- Then, operator submits the batches to the processor one by one.
- All the jobs of one batch are executed together.
Advantages-
- It saves the time that was being wasted earlier for each individual process in context switching from one environment to another environment.
- No manual intervention is needed.
Disadvantages-
Point-01:
Priority cannot be set for the jobs. |
In batch operating system,
- All the jobs of a batch are executed sequentially one after the other.
- The output is obtained only after all the jobs are executed.
- Thus, priority can not be implemented if a certain job has to be executed on an urgent basis.
Point-02:
Batch operating system may lead to starvation. |
In batch operating system,
- The jobs of a particular batch might take long time for their execution.
- This might lead to starvation to other jobs in other batches.
Point-03:
CPU may remain idle for a long time. |
In batch operating system,
- If the jobs of a batch require some I/O operation, then CPU must wait till the I/O operation gets completed.
- Since I/O devices are very slow, CPU remains idle for a long time.
- CPU cannot take any other job and execute it.
Point-04
There is a lack of interaction between a user and his job. |
In batch operating system,
- Once a batch is submitted for execution, the user is not able to interact with any of his jobs.
- If a job requires the user to input data during run time, then user must wait till the other jobs of the batch get executed.
- This also increases the overall execution time.
7. Explain Multi programmed Batch System of an opeating system
- This sort of OS is utilized to execute more than one job at the same time by a single processor.
- It builds CPU by sorting out jobs with the goal that the CPU consistently has one job to execute.
- The idea of multiprogramming is depicted as pursues:
- Every one of the job that enter the system are kept in the job pool( in a disk). The operating system stacks a lot of jobs from job pool into main memory and starts to execute.
- During execution, the job may need to wait for some task, for example, an I/O operation, to finish. In a multiprogramming system, the operating system basically changes to another activity and executes. At the point when that job needs to wait, the CPU is changed to another job, etc.
- At the point when the first job completes the process of waiting and it recovers the CPU.
- For whatever length of time that in any event one job needs to execute, the CPU is never idle.
- Multiprogramming operating systems utilize the component of job scheduling and CPU scheduling.
8. Explain Time Sharing System of an operating system
- Time-sharing systems are not accessible in 1960s.
- Time-sharing or performing multiple tasks is a legitimate expansion of multiprogramming. That is processors time is shared among numerous users at the same time is called time-sharing.
- The primary contrast between Multi-programmed Batch Systems and Time-Sharing Systems is, in Multi-programmed batch systems its goal is expand processor use, while in Time-Sharing Systems its goal is minimize response time.
- Numerous jobs are executed by the CPU by switching between them , however the switches happen in such a less time, so that the user can gets a prompt response.
- For instance, in an transaction processing, processor execute every user program in a short burst or quantum of calculation.
- That is if n users are available, every user can get time quantum.
- At the point when the user presents the instruction, the response time is seconds all things considered.
- Operating system utilizes CPU scheduling and multiprogramming to give every user a little part of a time.
- Computer systems that were structured essentially as batch systems have been altered to time-sharing systems.
- For instance IBM's OS/360.
Time-Sharing Operating System
- As the name itself recommends, in a time-sharing system or performing various tasks system, different jobs can be executed on a system simultaneously by sharing the CPU time among them.
- It is viewed as an logical expansion of multiprogramming on the grounds that the two does synchronous execution yet vary in their prime aims.
- The fundamental goal of time-sharing systems is to limit reaction time yet not boosting the processor use(which is the target of multiprogramming systems).
- The time sharing systems were created to give an intuitive utilization of the computer system.
- A time shared system utilizes CPU planning and multiprogramming to give every user a little segment of a period shared computer.
- It enables numerous users to share the computer resources all the while. As the system switches quickly from one user to the next, a brief timeframe opening is given to every user for their executions.
- The time sharing operating system guarantees that every one of the assignments get the chance to get to the CPU individually and for a fixed little interval of time. This interval is known as the time quantum.
- Eg: Unix Systems
Advantages of Time-Sharing OS:
- Each user gets an equivalent chance
- Less chances of duplication of programming
- CPU inert time can be diminished
Disadvantages of Time-Sharing OS:
- Unwavering quality issue
- One must need to deal with security and respectability of user programs and information.
- Information correspondence issue
Time-Sharing Operating System
9. What is the different Operation on process of an operating system?
- There are numerous operations that can be performed on processes. A portion of these are process creation, process preemption, process blocking, and process termination.
Process Creation
- Processes should be created in the system for various activities. This should be possible by the accompanying events:
- User request for process creation
- System initialization
- Execution of a process creation system call by a running process
- Batch job initialization
- A process might be created by another process utilizing fork(). The creating process is known as the parent process and the created process is the child process.
- A child process can have just one parent yet a parent process may have numerous Childs. Both the parent and child processes have a similar memory space, open files, and environment strings. But they may have different address spaces.
Process Preemption
- An interrupt component is utilized in preemption that suspends the process executing as of now and the next process to execute is identified by the short term scheduler.
- Preemption ensures that all processes get some CPU time for execution.
Process Blocking
- The process is blocked only if that process is waiting for some event to occur like I?O device availability.
- This event might be I/O, because the I/O events are executed in the main memory and they don't require the processor for their execution.
- After the event is finished, the process again goes to the ready state to completes its execution.
Process Termination
- After the process has finished the execution all its instructions, it will be terminated. All the resources held by a process are released as soon it is terminated.
- A child process can be terminated by its parent process if its task is no longer needed.
- Before terminating the child process sends its complete status to the parent process.
- Additionally, if the parent process is terminated first, all its child processes terminate automatically also the child processes can't run if the parent processes are terminated.
10. What is Cooperating process of an operating system?
Cooperating processes are those that can affect or are affected by other processes running on the system. Cooperating processes may share data with each other.
Reasons for needing cooperating processes
There may be many reasons for the requirement of cooperating processes. Some of these are given as follows −
- Modularity
Modularity involves dividing complicated tasks into smaller subtasks. These subtasks can completed by different cooperating processes. This leads to faster and more efficient completion of the required tasks.
- Information Sharing
Sharing of information between multiple processes can be accomplished using cooperating processes. This may include access to the same files. A mechanism is required so that the processes can access the files in parallel to each other.
- Convenience
There are many tasks that a user needs to do such as compiling, printing, editing etc. It is convenient if these tasks can be managed by cooperating processes.
- Computation Speedup
Subtasks of a single task can be performed parallely using cooperating processes. This increases the computation speedup as the task can be executed faster. However, this is only possible if the system has multiple processing elements.
Methods of Cooperation
Cooperating processes can coordinate with each other using shared data or messages. Details about these are given as follows −
- Cooperation by Sharing
The cooperating processes can cooperate with each other using shared data such as memory, variables, files, databases etc. Critical section is used to provide data integrity and writing is mutually exclusive to prevent inconsistent data.
A diagram that demonstrates cooperation by sharing is given as follows −
In the above diagram, Process P1 and P2 can cooperate with each other using shared data such as memory, variables, files, databases etc.
- Cooperation by Communication
The cooperating processes can cooperate with each other using messages. This may lead to deadlock if each process is waiting for a message from the other to perform a operation. Starvation is also possible if a process never receives a message.
A diagram that demonstrates cooperation by communication is given as follows −
In the above diagram, Process P1 and P2 can cooperate with each other using messages to communicate.