Skip to main content
Engineering LibreTexts

8.9: Execution within the Operating System

  • Page ID
    82878
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    There are some concepts we need to clarify as we discuss the concept of execution within the operating system. 

    What is the kernel

    The kernel is a computer program at the core of a computer's operating system that has complete control over everything in the system. It is the "portion of the operating system code that is always resident in memory", and facilitates interactions between hardware and software components. On most systems, the kernel is one of the first programs loaded on startup (after the bootloader). It handles the rest of startup as well as memory, peripherals, and input/output (I/O) requests from software, translating them into data-processing instructions for the central processing unit.

    Introduction to System Call

    In computing, a system call when a program program requests a service from the kernel of the operating system it is executed on. A system call is a way for programs to interact with the operating system. Application programs are NOT allowed to perform certain tasks, such as open a file, or create a new process. System calls provide the services of the operating system to the application programs via Application Program Interface(API). It provides an interface between a process and operating system to allow user-level processes, that is the applications that users are running on the system,  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 :

    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.

    Types of System Calls : There are 5 different categories of system calls 

    1. Process control: end, abort, create, terminate, allocate and free memory.
    2. File management: create, open, close, delete, read file etc.
    3. Device management
    4. Information maintenance
    5. Communication

    The following are some examples of system calls in Windows and Linux. So, if a user is running a word processing tool, and wants to save the document - the word processor asks the operating system to create a file, or open a file, to save the current set of changes. If the application has permission to write to the requested file then the operating system performs the task. Otherwise, the operating system returns a status telling the user they do not have permission to write to the requested file. This concept of user versus kernel allows the operating system to maintain a certain level of control.

      Windows Linux
    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()

     

    Adapted from:
    "Kernel (operating system)" by Multiple ContributorsWikipedia is licensed under CC BY-SA 3.0
    "Introduction of System Call" by Samit MandalGeeks for Geeks is licensed under CC BY-SA 4.0


    This page titled 8.9: Execution within the Operating System is shared under a CC BY-SA license and was authored, remixed, and/or curated by Patrick McClanahan.