Sunday, December 21, 2014

System Call

1. User operating-system Interface

  • Two main approaches
    • command-line interpreter (a.k.a. command interpreter or shell)
    • graphical user interface (GUI)
  • The shell
    • allows users to directly enter commands that are to be performed by the operating system
    • is usually a system program (not part of the kernel)
  • GUI allows a mouse-based window-and-menu system
  • Some systems allow (e.g., X-Windows in Unix)
2. System Calls
  • System calls provide the nterface between the a running program and the operating system
    • generally available in routines written in C and C++
    • certain low-level tasks may have to be written using assembly language
  • Typically, application programmers design programs using an application programming interface (API)
  • The run-time support system (run-time libraries) provides a system-call interface, that intercepts function calls in the API and invokes the necessary system call within the operating system.
3. Example System-Call Processing




4. System Call: read (fd, buffer, nbvtes)



5. Major System Calls in Unix: Process Management
  • pid = fork()
    • create a child process identical to the parent
  • pid = waitpid( pid, &statloc, options)
    • wait for a child to terminate
  • s = execve(name, argv, environp)
    • repalce a process' core image
  • exec()
    • i.e., load the selected program into memory
  • exit(status)
    • terminate process execution and return status 
  • s = kill(pid, signal)
    • send a signal to a process
6. System program
  • System programs provide a convenient environment for program development
  • They can provide various services
    • status information
    • file modification
    • programming language support
    • program loading and execution
    • communications

No comments:

Post a Comment