














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Notes decsribe the services provided by operating system
Typology: Study notes
1 / 22
This page cannot be seen from the preview
Don't miss anything!















Resource allocation Protection
Simply put, the shell is a program that takes commands from the keyboard and gives them to the operating system to perform. In the old days, it was the only user interface available on a Unix-like system such as Linux. Nowadays, we have graphical user interfaces (GUIs) in addition to command line interfaces (CLIs) such as the shell. On most Linux systems a program called bash (which stands for Bourne Again Shell, an enhanced version of the original Unix shell program, sh, written by Steve Bourne) acts as the shell program. Besides bash, there are other shell programs available for Linux systems. These include: ksh, tcsh and zsh. Bourne Shell Command Interpreter The Bourne shell is an interactive command interpreter and command programming language. The bsh command runs the Bourne shell. What is Xerox PARC famous for? 1973: Superpaint frame buffer. Xerox PARC computer scientists record the first video image on the first computer paint system – a graphics program and framebuffer computer. This paves the way for the earliest computer animations and later earns its inventors an Emmy and an Academy Award. Introduction to System Call A computer program makes a system call when it makes a request to the operating system’s kernel. System call provides the services of the operating system to the user programs via Application Program Interface(API). It provides an interface between a process and operating system to allow user-level processes to request services of the operating system. System calls are the only entry points into the kernel system. All programs needing resources must use system calls. Services Provided by System Calls :
Device management Information maintenance Communication Protection Examples of Windows and Unix System Calls – Why do we use an API rather than direct system call in the OS?
surroundings or the Third party API’s, for which we have to get the codes from other sites on the web(e.g. Facebook, Twitter). Types of APIs: There are three basic forms of API- WEB APIs: A Web API also called as Web Services is an extensively used API over the web and can be easily accessed using the HTTP protocols. A Web API is an open source interface and can be used by a large number of clients through their phones, tablets. or PC’s. LOCAL APIs: In this types of API, the programmers get the local middleware services. TAPI (Telephony Application Programming Interface), .NET are common examples of Local API’s. PROGRAM APIs: It makes a remote program appears to be local by making use of RPC’s (Remote Procedural Calls). SOAP is a well-known example of this type of API. Few other types of APIs: SOAP (SIMPLE OBJECT ACCESS PROTOCOL): It defines messages in XML format used by web applications to communicate with each other. REST (Representational State Transfer): It makes use of HTTP to GET, POST, PUT, or DELETE data. It is basically used to take advantage of the existing data. JSON-RPC: It use JSON for data transfer and is a light-weight remote procedural call defining few data structure types. XML-RPC: It is based on XML and uses HTTP for data transfer. This API is widely used to exchange information between two or more networks. Above are the various types and forms of API’s extensively used over web networks to exchange information and to enhance communication between them.
Advantages of APIs – Efficiency: API produces efficient, quicker and more reliable results than the outputs produced by human beings in an organization. Flexible delivery of services: API provides fast and flexible delivery of services according to developers requirements. Integration: The best feature of API is that it allows movement of data between various sites and thus enhances integrated user experience. Automation: As API makes use of robotic computers rather than humans, it produces better and automated results. New functionality: While using API the developers find new tools and functionality for API exchanges. Disadvantages of APIs – Cost: Developing and implementing API is costly at times and requires high maintenance and support from developers. Security issues: Using API adds another layer of surface which is then prone to attacks, and hence the security risk problem is common in API’s. SYSTEM CALL from tutorialpoint.com System calls are usually made when a process in user mode requires access to a resource. Then it requests the kernel to provide the resource via a system call. A figure representing the execution of the system call is given as follows − As can be seen from this diagram, the processes execute normally in the user mode until a system call interrupts this. Then the system call is executed on a priority basis in the kernel
file. A file can be opened by multiple processes at the same time or be restricted to one process. It all depends on the file organisation and file system. read() The read() system call is used to access data from a file that is stored in the file system. The file to read can be identified by its file descriptor and it should be opened using open() before it can be read. In general, the read() system calls takes three arguments i.e. the file descriptor, buffer which stores read data and number of bytes to be read from the file. write() The write() system calls writes the data from a user buffer into a device such as a file. This system call is one of the ways to output data from a program. In general, the write system calls takes three arguments i.e. file descriptor, pointer to the buffer where data is stored and number of bytes to write from the buffer. close() The close() system call is used to terminate access to a file system. Using this system call means that the file is no longer required by the program and so the buffers are flushed, the file metadata is updated and the file resources are de-allocated. https://www.tutorialspoint.com/what-are-system-calls-in-operating-system What does POSIX stand for? Portable Operating System Interface POSIX (Portable Operating System Interface) is a set of standard operating system interfaces based on the Unix operating system. Unistd.h In the C and C++ programming languages, unistd.h is the name of the header file that provides access to the POSIX operating system API. A system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is executed on. Through a system call the programs interact with the operating system. Often some additional information is required when a system call is executed. The exact type and amount of information might vary according to the particular operating system and the particular system call. This additional information that we pass is nothing more than a variable and we name it a parameter. For example to get input, we may need to specify the file from which we need to read. Parameters in this
context generally are passed to system calls in the same way that parameters are passed to other functions in programming. There are three ways to pass parameters:
Static links. These are linked earlier in the process and are embedded into the executable. Static libraries are linked to the executable when the program is compiled. Dynamic libraries are linked later, either at runtime or at load time. Static libraries are not shared between programs because they are written into the individual executable. Dynamic links. DLLs contain the files that a program links to. The libraries already are stored on the computer, external to the program that the user writes. They are called dynamic because they are not embedded in the executable -- they just link to it when needed. An import library, which is a type of static library, replaces all placeholder symbols with actual links to the necessary DLL data in the main program at load time, pulling those functions from the DLL library. Programs provide the name of the library, and the OS creates a path to the link library. Different programs have their own language-specific calling conventions for linking to DLLs. Because dynamic libraries are not written into the executable, the same shared library can be used by more than one program at the same time. They can also be modified without changing the entire program that is using it.
Operating system can be implemented with the help of various structures. The structure of the OS depends mainly on how the various common components of the operating system are interconnected and melded into the kernel. Depending on this we have following structures of the operating system: 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. Diagram of the structure of MS-DOS is shown below. 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. Layered structure: An OS can be broken into pieces and retain much more control on system. In this structure the OS is broken into number of layers (levels). The bottom layer (layer 0) is the hardware and the topmost layer (layer N) is the user interface. These layers are so designed that each layer uses the functions of the lower level layers only. This simplifies the debugging process as if lower level layers are debugged and an error occurs during debugging then the error must be on that layer only as the lower level layers have already been debugged. The main disadvantage of this structure is that at each layer, the data needs to be modified and passed on which adds overhead to the system. Moreover careful planning of the layers is necessary as a layer can use only lower level layers. UNIX is an example of this structure.
It is considered as the best approach for an OS. It involves designing of a modular kernel. The kernel has only set of core components and other services are added as dynamically loadable modules to the kernel either during run time or boot time. It resembles layered structure due to the fact that each kernel has defined and protected interfaces but it is more flexible than the layered structure as a module can call any other module. For example Solaris OS is organized as shown in the figure. Microkernel in Operating Systems Difficulty Level : Medium Last Updated : 10 Feb, 2022 Kernel is the core part of an operating system that manages system resources. It also acts as a bridge between the application and hardware of the computer. It is one of the first programs loaded on start-up (after the Bootloader).
Kernel mode and User mode of CPU operation The CPU can execute certain instructions only when it is in kernel mode. These instructions are called privilege instruction. They allow the implementation of special operations whose execution by the user program could interface with the functioning of the operating system or activity of another user program. For example, instruction for managing memory protection. The operating system puts the CPU in kernel mode when it is executing in the kernel so, that kernel can execute some special operation. The operating system puts the CPU in user mode when a user program is in execution so, that the user program cannot interface with the operating system program. User-level instruction does not require special privilege. Example are ADD,PUSH,etc. The concept of modes can be extended beyond two, requiring more than a single mode bit CPUs that support virtualization use one of these extra bits to indicate when the virtual machine manager, VMM, is in control of the system. The VMM has more privileges than ordinary user programs, but not so many as the full kernel. System calls are typically implemented in the form of software interrupts, which causes the hardware’s interrupt handler to transfer control over to an appropriate interrupt handler, which is part of the operating system, switching the mode bit to kernel mode in the process. The interrupt handler checks exactly which interrupt was generated, checks additional parameters ( generally passed through registers ) if appropriate, and then calls the appropriate kernel service routine to handle the service requested by the system call. User programs’ attempts to execute illegal instructions ( privileged or non-existent instructions ), or to access forbidden memory areas, also generate software interrupts, which are trapped by the interrupt handler, and control is transferred to the OS, which issues an appropriate error message, possibly dumps data to a log ( core ) file for later analysis, and then terminates the offending program.
Advantages of Microkernel – The architecture of this kernel is small and isolated hence it can function better. Expansion of the system is easier, it is simply added to the system application without disturbing the kernel. Linus Loadable Kernel Module If you want to add code to a Linux kit, the basic way to do that is to add source files to the kernel source tree and assemble the kernel. In fact, the process of setting up the kernel consists mainly to select which files to upload to the kernel will be merged. But you can also add code to the Linux kit while it is running. A piece of code you add this way is called a loadable kernel module (LKM). These modules can do many things, but they are usually one of three items: device drivers file system drivers system calls. Quiz on Operating System Services
View Answer Ans : D Explanation: All of the above are services provided by an operating system.