OPS Unit 01 Notes
OPS Unit 01 Notes
⎯ The OS coordinates the use of the hardware and application programs for
various users. It provides a platform for other application programs to work.
⎯ The operating system is a set of special programs that run on a computer system
that allows it to work properly.
⎯ It controls input-output devices, execution of programs, managing files, etc.
⎯ Services of Operating System:
1. Program Execution
2. Input Output Operations
3. File Management
4. Error Handling
5. Resource Management
6. Communication between Processes
1. Program Execution:
3. File Management:
⎯ The operating system helps in managing files also. If a program needs
access to a file, it is the operating system that grants access. These
permissions include read-only, read-write, etc.
⎯ It also provides a platform for the user to create, and delete files. The
Operating System is responsible for making decisions regarding the
storage of all types of data or files, i.e, floppy disk/hard disk/pen drive,
etc.
4. Error Handling:
⎯ The Operating System also handles the error occurring in the CPU, in
Input-Output devices, etc.
⎯ It also ensures that an error does not occur frequently and fixes the errors. It
also prevents the process from coming to a deadlock.
5. Resource Management:
⎯ System resources are shared between various processes. It is the
Operating system that manages resource sharing.
⎯ It also manages the CPU time among processes using CPU Scheduling
Algorithms.
⎯ It also helps in the memory management of the system.
⎯ It also controls input-output devices.
There are commonly five types of system calls. These are as follows:
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
1.Process Control
Process control is the system call that is used to direct the processes. Some process control
examples include creating, load, abort, end, execute, process, terminate the process, etc.
2.File Management
File management is a system call that is used to handle the files. Some file management
examples include creating files, delete files, open, close, read, write, etc.
3.Device Management
Device management is a system call that is used to deal with devices. Some examples of
device management include read, device, write, get device attributes, release device, etc.
4.Information Maintenance
Information maintenance is a system call that is used to maintain information. There are some
examples of information maintenance, including getting system data, set time or date, get
time or date, set system data, etc.
5.Communication
Communication is a system call that is used for communication. There are some examples of
communication, including create, delete communication connections, send, receive
messages, etc.
1.open()
⎯ The open() system call allows you to access a file on a file system. It allocates
resources to the file and provides a handle that the process may refer to.
t is used to obtain data from a file on the file system. It accepts three arguments in
general:
2.wait()
In some systems, a process may have to wait for another process to complete its
execution before proceeding. When a parent process makes a child process, the parent
process execution is suspended until the child process is finished. The wait() system
call is used to suspend the parent process. Once the child process has completed its
execution, control is returned to the parent process.
3.write()
It is used to write data from a user buffer to a device like a file. This system call is one
way for a program to generate data. It takes three arguments in general:
o A file descriptor.
o A pointer to the buffer in which data is saved. o The number of
bytes to be written from the buffer.
4.fork()
Processes generate clones of themselves using the fork() system call. It is one of the
most common ways to create processes in operating systems. When a parent process
spawns a child process, execution of the parent process is interrupted until the child
process completes. Once the child process has completed its execution, control is
returned to the parent process.
5.close()
It is used to end file system access. When this system call is invoked, it signifies that
the program no longer requires the file, and the buffers are flushed, the file
information is altered, and the file resources are de-allocated as a result.
6.exec()
7.exit()
The exit() is a system call that is used to end program execution. This call indicates
that the thread execution is complete, which is especially useful in multi-threaded
environments. The operating system reclaims resources spent by the process following
the use of the exit() system function.
❖ Kernel Architecture
⎯ Kernel is central component of an operating system that manages operations of
computer and hardware.
⎯ Kernel loads first into memory when an operating system is loaded and remains
into memory until operating system is shut down again. It is responsible for
various tasks such as disk management, task management, and memory
management.
⎯ A kernel must be fast and responsive. It needs to handle all the requests and
responses quickly and efficiently. To do this, the Kernel uses a lot of
kernellevel memory.
⎯ This memory is isolated from the main memory of your computer. This means
that the Kernel can use it to store data and code without affecting other
applications.
⎯ The Kernel controls everything that goes on in your computer, from launching
applications to managing your files. The Kernel is also responsible for security,
ensuring unauthorized users can’t access your system.
User Mode
When an application like MS word handling a text editor runs on the operating
system, the system is in user mode. The mode bit is 0 in that case. The mode bit will
change from 1 to 0 if it switches to kernel mode. The user mode to kernel mode is
switched when there is a need to access any device or any interrupt/system call
occurs.
Kernel-mode
When the system boots, the system starts with kernel mode. And the applications are
executed in user mode. The switch can happen from user mode to kernel mode when
• Interrupt occurs
• The mode bit is changed from 0 to 1 in case of the system switch back to
user mode.
1. Simple structure:
⎯ Such operating systems do not have well defined structure and are small,
simple and limited systems. The interfaces and levels of functionality are
not well separated. MS-DOS is an example of such operating system.
⎯ In MS-DOS application programs are able to access the basic I/O routines.
⎯ These types of operating system cause the entire system to crash if one of
the user programs fails. Advantages of Simple structure:
• It delivers better application performance because of the few interfaces
between the application program and the hardware.
• Easy for kernel developers to develop such an operating system.
Disadvantages of Simple structure:
• The structure is very complicated as no clear boundaries exists between
modules.
• It does not enforce data hiding in the operating system.
1. Layered Struture:
3. Micro-kernel:
This structure designs the operating system by removing all
nonessential components from the kernel and implementing them as
system and user programs. This result in a smaller kernel called the
micro-kernel.
Advantages of this structure are that all new services need to be added to
user space and does not require the kernel to be modified.
Thus it is more secure and reliable as if a service fails then rest of the
operating system remains untouched. Mac OS is an example of this type
of OS.
Advantages of Micro-kernel structure:
• It makes the operating system portable to various platforms.
• As microkernels are small so these can be tested effectively.
• Disadvantages of Micro-kernel structure:
• Increased level of inter module communication degrades system
performance.
4. Monolithic Kernel:
Examples:
Windows 1, Windows 2, Windows 3, Windows 95, Windows 98,
All Linux distribtions - CentOS, Ubuntu, Red Hat's Fedora, Red Hat
Enterprise, Open SUSE and all other linux distributions