1. System Calls

A system call is how a program requests a service from an operating system's kernel. This may include hardware related services (e.g. accessing the hard disk), creating and executing new processes, and communicating with integral kernel services (like scheduling). System calls provide an essential interface between a process and the operating system.

A system call is a mechanism that is used by the application program to request a service from the operating system. They use a machine-code instruction that causes the processor to change mode. An example would be from supervisor mode to protected mode. This is where the operating system performs actions like accessing hardware devices or the memory management unit. Generally, the operating system provides a library that sits between the operating system and normal programs.                                                       

System calls provide the interface between a process and the operating system. Most operations interacting with the system require permissions not available to a user level process, e.g. I/O performed with a device present on the system, or any form of communication with other processes requires the use of system calls.

Services Provided by System Calls:

  1. Process creation and management
  2. Main memory management
  3. File Access, Directory and File system management
  4. Device handling(I/O)
  5. Protection
  6. Networking etc

Example of read () system call

read (fd, buffer, nbytes);

The system call (and the library procedure) return the number of bytes actually read in count. This value is normally the same as nbytes, but may be smaller, if, for example, end-of-file is encountered while reading.

It is explained in below diagram:

SERVICES

WINDOWS

UNIX

 

Process Control

CreateProcess() ExitProcess() WaitForSingleObject()

fork()

exit()

wait()

 

File Manipulation

CreateFile() ReadFile() WriteFile() CloseHandle()

open()

read() write() close()

 

Device Manipulation

SetConsoleMode() ReadConsole() WriteConsole()

ioctl() read() write()

 

Information Maintenance

GetCurrentProcessID() SetTimer()

Sleep()

getpid() alarm() sleep()

 

Communication

CreatePipe() CreateFileMapping() MapViewOfFile()

pipe() shmget() mmap()

 

Protection

SetFileSecurity() InitlializeSecurityDescriptor() SetSecurityDescriptorGroup()

chmod() umask() chown()

2. Shell and Kernel

Shell and the kernel are the parts of this Operating system. These both parts are used for performing any operation on the system. When a user gives his command for performing any operation, then the request will go to the shell parts, the shell parts is also called as the interpreter which translate the human program into the machine language and then the request will be transferred to the kernel that means shell is just as the interpreter of the commands which converts the request of the user into the machine language.

Kernel is also known as heart of operating system and every operation is performed by using the kernel, when the kernel receives the request from the shell then this will process the request and display the results on the screen.

The various types of operations those are performed by the kernel are as followings:

  • It controls the state of the process means it checks whether the process is running or process is waiting for the request of the user.
  • Provides the memory for the processes those are running on the system means kernel runs the allocation and de-allocation process, first when we request for the service then the kernel will provide the memory to the process and after that it also release the memory which is given to a process.
  • The kernel also maintains a time table for all the processes those are running means the kernel also prepares the schedule time means this will provide the time to various process of the CPU and the kernel also puts the waiting and suspended jobs into the different memory area.
  • When a kernel determines that the logical memory doesn’t fit to store the programs. Then he uses the concept of the physical memory which will store the programs into temporary manner i.e. virtual memory.
  • Kernel also maintains all the files those are stored into the computer system and the kernel also stores all the files into the system as no one can read or write the files without any So that the kernel system also provides us the facility to use the passwords and also all the files are stored into the particular manner.

As we have learned there are many programs or functions those are performed by the kernel but the functions those are performed by the kernel will never be shown to the user. And the functions of the kernel are transparent to the user.