Skip to main content

Section B 6 Define System Calls

Define System Calls

  • The mechanism used by an application program to request service from the operating system. System calls often use a special machine code instruction which causes the processor to change mode (e.g. to "supervisor mode" or "protected mode"). 
  • This allows the OS to perform restricted actions such as accessing hardware devices or the memory management unit.
  • The system call provides an interface to the operating system services.
  • Application developers often do not have direct access to the system calls, but can access them through an application programming interface (API). The functions that are included in the API invoke the actual system calls. By using the API, certain benefits can be gained:
  • Portability: as long a system supports an API, any program using that API can compile and run.
  • Ease of Use: using the API can be significantly easier then using the actual system call.

 System Call Parameters

Three general methods exist for passing parameters to the OS:

  • Parameters can be passed in registers.
  • When there are more parameters than registers, parameters can be stored in a block and the block address can be passed as a parameter to a register.
  • Parameters can also be pushed on or popped off the stack by the operating system.

Types of System Calls

There are 5 different categories of system calls:

  1. Process control
  2. File manipulation
  3. Device manipulation
  4. Information maintenance
  5. Communication

Process Control

  • A running program needs to be able to stop execution either normally or abnormally. When execution is stopped abnormally, often a dump of memory is taken and can be examined with a debugger.

File Manipulation

  • Some common system calls are create, delete, read, write, reposition, or close. Also, there is a need to determine the file attributes – get and set file attribute. Many times the OS provides an API to make these system calls.

Device Manipulation

  • Process usually require several resources to execute, if these resources are available, they will be granted and control returned to the user process. These resources are also thought of as devices. Some are physical, such as a video card, and others are abstract, such as a files.
  • User programs request the device, and when finished they release the device. Similar to files, we can read, write, and reposition the device.

Information Maintenance

  • Some system calls exist purely for transferring information between the user program and the operating system. An example of this is time, or date.
  • The OS also keeps information about all its processes and provides system calls to report this information.

Communication

  • There are two models of interprocess communication, the message-passing model and the shared memory model.
     
  1. Message-passing uses a common mailbox to pass messages between processes.
  2. Shared memory use certain system calls to create and gain access to create and gain access to regions of memory owned by other processes. The two processes exchange information by reading and writing in the shared data.

Steps in Making a System Call 

There are 11 steps in making the system call read (fd, buffer, nbytes)

Some System Calls For Process Management

Some System Calls For File Management

Some System Calls For Directory Management

Some System Calls For Miscellaneous Tasks

 
System Calls (5)

Some Win32 API calls




 

 Video about System Call in Operating Systems


Comments

Popular posts from this blog

2.1.4 Distinguish between logical I/O and physical I/O

2.1.4 Distinguish between logical I/O and physical I/O logical input relate to hard disk Logical I/O an Physical I/O Physical" I/O is an actual fetch of data from a storage device such as a disk. Logical" I/O is a programmatic request for data satisfied by a memory (block, buffer) access. A logical I/O may cause a physical I/O in the first place, or a logical I/O may retrieve a part of a block (buffer) of data from memory. 2.1.5 Distinguish between directory management and disk space management. Directory management A directory is a hierarchical collection of directories and files.  The only constraint on the number of files that can be contained in a single directory is the physical size of the disk on which the directory is located. Disk management A hard disk is a rigid disk inside a computer that stores and provides relatively quick access to large amounts of data. It is the type of storage most often used with Windows. The system also supp

3.1.1 Identify Between Resident And Transient Routines

Memory Management Memory management is concerned with managing: The computer’s available pool of memory Allocating space to application routines and making sure that they do not interfere with each other. 3.1.1 Identify between resident and transient routines The operating system is a collection of software routines. Resident routines Transient routines Routines that directly support application programs as they run Stored on disk and read into memory only when needed Example: routine that control physical I/O Example: routine that formats disks The operating system occupies low memory beginning with address 0. Key control information comes first followed by the various resident operating system routines. The remaining memory, called the transient area, is where application programs and transient operating system routines are loaded. Resident & transient routines structure

Operating Systems Definition and the Classification of OS

             OPERATING SYSTEMS ( OS ) What is an operating system? An operating system (sometimes abbreviated as "OS") is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer. The other programs are called applications or application programs. The application programs make use of the operating system by making requests for services through a defined application program interface (API). In addition, users can interact directly with the operating system through a user interface such as a command language or a graphical user interface (GUI). An operating system performs these services for applications:     In a multitasking operating system where multiple programs can be running at the same time, the operating system determines which applications should run in what order and how much time should be allowed for each application before giving another application a turn.     It manages the sharing of