Notices
Notice: Exam Form BE IV/II & BAR V/II (Back) for 2076 Magh
Routine: BE IV/II & BAR V/II - 2076 Magh
Result: BCE I/II exam held on 2076 Bhadra
Result: All (except BCE & BEI) I/II exam held on 2076 Bhadra
Notice: Exam Center for Barrier Exam (2076 Poush), 1st Part
View All
View Old Questions
Computer Engineering(BCT)
Electrical Engineering(BEL)
Electronics and Communication(BEX)
View All
View Syllabus
Computer Engineering(BCT)
Electrical Engineering(BEL)
Electronics and Communication(BEX)
View All

Notes of Operating System [CT 656]

Introduction to OS

Introduction to OS

Operating System and Functions

1.1.1 What is operating system?

Operating systems are those system programs that controls the available resources of a computer system and also provides the interface between the hardware and other application programs.


1.1.2 OS as extended or virtual machine or mediator (Top-down view)

The computer system is composed of hardware and application software interacting with each other to perform any computation. For any application to perform its task, it must deal with hardware for memory management, process control, storage and so on. But for a programmer, it would be tedious to consider the hardware level machine language programming for each application development. Operating system provides the high-level abstraction to deal with such issues.

Operating system provides a set of programs that handles the complex hardware level programming and provides the programmer an easy interface to develop application without hardware consideration. The OS masks the hardware details and provides the programmer easy interface for using the system.

For eg: consider the case of disks. A disk contains collection of files. Each file can be opened, read, written and closed. The hardware details like if recording should use modified FM or the current state of motor, etc. are masked by OS and also handled effectively.


1.1.3 OS as resource manager (Bottom-up view)

A computer system is a system with various resources like memory processor, disk, printer, etc. It is necessary to keep track of the resource allocation and usage in orhte to resolve conflict between two or more processes for allocation of same resources. Also, in a networked system, the sharing of hardware and information is very common. So, the need of managing memory and resources among the processes or the users is necessary.

The operating system provides an orderly and controlled allocation if resources among the programs or the users. It keeps track of current usages status of resources, who is using resource, to grant resource request if available and so on.

Eg. If 3 programs are requesting for a printer service the OS schedule the tasks based on priority. It can be managed by buffering all the output destined for the printer on disk

os-as-resource


Evolution of OS

[refer to OS design and Implementation by Tanenbaum, pg-5]


Types of OS: Batch, Interactive, Multiprocessing, Time Sharing and Real Time OS

1.3.1 Batch System

- Batch system is the OS in which the same task is excuted repeatedly in the batches without the intervention form the user.
- Once the initial commands are set up. No input of data is possible.
- Only the similar jobs can be given to the CPU for processing.
- Only one job could engage the processor at a time and if there was input/ output operation, the processor should remain idle till the completion I/O operation.


# Working Mechanism

The use prepares a program with predefined sequence of commands programs and data on an offline device and submit it to the computer operator. The OS keeps a number of jobs in memory. These jobs are grouped based on similar needs to firm a batch. The batch is processed in first come first served manner. After completion of job, its memory is released and the o/p gets into on o/p spool.

operating system batch processing


1.3.2 Interactive System

- The user can interact directly with OS to supply commands and data as applications program executes.
- The user receives the output immediately.
- There is direct too way communication between user and computer.
- A user interface is provided which may be command line or GUI.


1.3.3 Time- Sharing System(Multitasking)

- The processor’s time is shared among multiple users simultaneously.
- The main objective is to tasks by switching.
- It reduces CPU idle time.


1.3.4 Real Time Operating System

[Refer to Chapter 6 of Embedded System]


OS Commponents

1) Process Management [ch.2]
2) Memory Management [ch.4]
3) Disk and file System [ch.5]
4) Networking
5) Security [ch.8]


OS Structure: Monolithic, Layered, Micro-kernel, Client Server and Virtual Machine

1.5.1 Monolithic Structure

- The OS consists of a collection of procedures with well defined interface in terms of parameters and results, each of which is able to call any of the other procedures when needed.
- All kernel routines are bind together
into a single object file using system liner.
- Every procedure is visible to every other procedure. So, there is no privilege for data hiding.
- It provides good performance but is unstable and inflexible.
- Supervisor call or kernel call is done by putting parameters is well defined places like stack, registers and then execution a special trap instruction. This call requests for the operating system services and also switches the machine from user mode to kernel mode and transfers control to OS.

mono


1.5.2 Layered Structure

- The OS organized as a hierarchy of layers, each layer built on top lower layers.
- Layers are selected such that each uses functions and services of lower level layers only.
- Layers can be debugged and replaced independently without bothering any other layers.
- The lowest layer incorporates hardware while the topmost layer is user interface.
- Layering is possible only if all function dependencies can be sorted out into a directed acyclic graph.
- It is inefficient as the layers increase so is indirections form function to function resulting in bigger overhead in function call.

# Example

Consider a system with 6 layers as shown below:
Layer | Function
5 | Operator
4 | User programs
3 | I/O management
2 | Operator-process communication
1 | memory and drum management
0 | processor allocation and multi programming

Layer 0 deals with allocation of processor and switching between processes when needed. Above this layer, each can be programmed without worrying about the fact that multiple processes were running on a single processor. Layer 1 allocates space for processes in main memory and drums. Above layer 1, processes did not have to worry about whether they were in memory or on the drum. The layer 1 make sure that pages were brought to memory whenever needed.


1.5.3 Micro- kernel structure

- A microkernel is a reduced OS care that contains only essential OS functions.
- The kernel is minimized by moving up as much functionalities as possible from kernel into user space.
- For eg: The services like devices, VM management, etc are included in OS traditionally, but at present these are external running as user processes minimizing the kernel structure.
- It allows for easier code management due to its division into user space services.
- It provides increased security and stability. Eg: if a network service crashed due to buffer overflow, only the network service’s memory would be corrupted, leaving other system still functional.
- It is easier to extend microkernel OS as new services are added in user space.
- It results in performance overhead due to communication from user space to kernel space.


1.5.4 Virtual Machine structure


OS Services: System call, Shell commands and Shell programming

System call

- Provides interface between the process and the OS.
- It is provided by OS.
- User programs communicate with OS and request services by making system calls.
- The system call has library procedure which is called by users’ program.
- This procedure puts parameters of system call in register and issue TRAP instruction that start OS.
- This procedure hider all these details.
- Eg. Open, close, read, write, kill, wait.


Steps in System Call:

1) Push parameter onto stack (n bytes, &buffer, fd)
2) Call to library function
3) Put code in registers
4) Trap to kernel (supervisor all)
5) Kernel code examine system call dispatcher to correct handles.
6) Handles runs, once completed, control returned to library procedure.
7) Returns to actual user program stack is cleaner up.


Examples of OS

1. Windows
2. Linux
3. Mac OS
4. Tails
and so on.

Sponsored Ads