Program

Program is an executable file in Unix-based system such as Linux# and #macos, which could be a shell script, shell command, compiled file or object code file. It is created by a link editor and stored on a disk, and can be executed by the exec System Call# which will create a Process#.

Links to this page
  • Unix System Call
    exec (execute a new Program# and replace the current process)
  • TTP3121 Chapter 2: Introduction to Unix Based OS
  • Shell

    Shell is a #Program that sits between user and the Kernel# which act like a command line interpreter. It will read commands from the user and execute them.

  • Process

    Process is an instance of a #Program that is being executed. fork System Call# could be used to create a new Process. The process will inherit all the environment variables from the parent process. In #c, this could be accessed via function getenv(), which will either return a pointer to the specified environment variable or a NULL pointer, or third argument to the main function (shown below). The latter will be terminated with a NULL pointer.

  • I/O Multiplexing

    There will be the case where asynchronous I/O is desired in order to serve different I/O events at the same time. For example, a Program# might have to serve two read requests from different Processes. However, since serving one read request will always block another, it is unwise to listen just one of the socket and wait for it since the program can’t know which one will arrive first. It is the same concern for asynchronous Socket Programming where the server might need to serve two sockets at the same time while being ignorant about the order of their arrival. I/O Multiplexing using three Unix System Call# : select(), pselect(), and poll().

#operating-system #macos