Processes and threads

A process is an activity within the system that is started by a command, a shell program, or another process.

Process properties are as follows:

  • pid
  • pgid
  • uid
  • gid
  • environment
  • cwd
  • file descriptors
  • signal actions
  • process statistics
  • nice

These properties are defined in /usr/include/sys/proc.h file.

Thread properties are as follows:

  • stack
  • scheduling policy
  • scheduling priority
  • pending signals
  • blocked signals
  • thread-specific data

These thread properties are defined in /usr/include/sys/thread.h file.

Each process is made up of one or more threads. A thread is a single sequential flow of control. Multiple threads of control allow an application to overlap operations, such as reading from a terminal and writing to a file.

Multiple threads of control also allow an application to service requests from multiple users at the same time. Threads provide these capabilities without the added overhead of multiple processes such as those created through the fork() system call.

A fast fork routine called f_fork() was introduced in AIX. This routine is useful for multithreaded applications that calls the exec() subroutine immediately after you call the fork() subroutine. The fork() subroutine is slower because it calls fork handlers to acquire the library locks before forking, and permits the child to run the child handlers that initializes the locks. The f_fork() subroutine bypasses these handlers and calls the kfork() system call directly. Web servers are a good example of an application that can use the f_fork() subroutine.