Courses/Computer Science/CPSC 457.F2013/Lecture Notes/Creation

From wiki.ucalgary.ca
< Courses‎ | Computer Science‎ | CPSC 457.F2013‎ | Lecture Notes
Revision as of 21:18, 13 October 2013 by Vrvardeleon (talk | contribs) (Scribe Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Process Creation

In this session, we consider a definition of the term 'process' and what a process's main properties and characteristics are. We will observe how processes are created and destroyed; we will do these activities from the perspective of the system call layer.

We will also touch on the topic of OS--level concurrency via fork(2), vfork(2), and clone(2). This forecasts later topics like IPC (interprocess communication). In fact, the way Linux represents a process and a thread are exactly the same, and Linux uses the term "lightweight process" to represent this idea: a thread is a process and a process is a thread. The only real difference is that a group of threads may share access to the same process address space (i.e., set of memory regions).

Up until this point, we have been working with an intuitive notion of what processes are: they are running software application. Userland processes are "programs in execution." We have seen a few tools for observing the set of running programs and their properties, e.g., top(1), ps(1). We've seen how to interact with and control them through command line utilities like kill(1).

In this session, we will continue building our understanding of the process abstraction as a virtual CPU context (i.e., a snapshot of the execution state of a program) and a processes other properties. We will focus on an examination of how processes come to exist. We will start by considering what a process is (see task_struct for how Linux maintains metadata about a process).

We will also have a multi-perspective look at the routines

  • fork(2) / clone(2) / vfork(2)
  • execve(2)

Notes

What is involved in process creation? How does a process actually come to exist? We will glance over the source code of the kernel's routines for creating (or cloning) a process and loading an executable (i.e., ELF) image into a process address space. They lead to a chain of procedures in the OS that is a bit deeper and more complex than the system call interface might otherwise imply.

  • recall: what is the purpose of an OS?
    • to support the loading and execution of programs
    • protection / isolation between processes
    • multiplex resources for processes (provide the illusion of concurrent access and clean sharing)
  • what is a process?
    • a process is a program in execution
    • PCB task_struct
    • PAS (we will consider the structure of this next session)
    • what parts of the syscall API can be used to create a process?

We'll deal with an in-depth examination of the process address space next session

Scribe Notes

Readings

  • LDK Chapter 3
  • MOS: Section 2.1: Processes (this should be partly review of what we've talked about in class)
  • MOS: Section 10.2.5 (Linux kernel structure)
  • MOS: Section 10.3.1 (about processes in Linux) should reinforce some class discussion