Skip to content

Latest commit

 

History

History
68 lines (46 loc) · 4.17 KB

W06.md

File metadata and controls

68 lines (46 loc) · 4.17 KB
permalink
/W06/

HOME


TOP 10 LIST WEEK 06

1. Process
A process is basically a program in execution. The execution of a process must progress in a sequential fashion.To put it in simple terms, we write our computer programs in a text file and when we execute this program, it becomes a process which performs all the tasks mentioned in the program.

2. Main Seven States of A Process

  • New: The new process is created when a specific program calls from secondary memory/ hard disk to primary memory/ RAM.

  • Ready: In a ready state, the process should be loaded into the primary memory, which is ready for execution.

  • Waiting: The process is waiting for the allocation of CPU time and other resources for execution.

  • Executing: The process is an execution state.

  • Blocked: It is a time interval when a process is waiting for an event like I/O operations to complete.

  • Suspended: Suspended state defines the time when a process is ready for execution but has not been placed in the ready queue by OS.

  • Terminated: Terminated state specifies the time when a process is terminated

3. Process Control Block
Process Control Block is a data structure that contains information of the process related to it. The process control block is also known as a task control block, entry of the process table, etc

4. Process identifier
Process identifier (PID) is a number used by some operating system kernels (such as that of UNIX, Mac OS X or Windows NT) to uniquely identify a process.

5. fork()
System call fork() is used to create processes. It takes no arguments and returns a process ID. The purpose of fork() is to create a new process, which becomes the child process of the caller. After a new child process is created, both processes will execute the next instruction following the fork() system call.

We can differentiate the parent from the child by testing the returned value of fork():

  • Negative: the creation of a child process was unsuccessful.

  • Zero: returns a zero to the newly created child process

  • Positive: returns the process ID of the child process, to the parent.

6. Sleep
Sleep() is implemented at the OS level. The processor doesn't spin when a task/thread/process is sleeping. That particular thread is put on a pending queue (the thread isn't ready to run) until the time has expired at which point the thread will be placed on the ready to run queue.

7. execlp
The execlp system call duplicates the actions of the shell in searching for an executable file if the specified file name does not contain a slash (/) character. The search path is the path specified in the environment by the PATH variable. If this variable isn’t specified, the default path ":/bin:/usr/bin" is used.

8. Thread
A thread is a flow of execution through the process code, with its own program counter that keeps track of which instruction to execute next, system registers which hold its current working variables, and a stack which contains the execution history.

9. Pthread
Pthreads are defined as a set of C language programming types and procedure calls, implemented with a pthread.h header/include file and a thread library - though this library may be part of another library, such as libc, in some implementations.

10. Concurrency
Concurrency is the execution of the multiple instruction sequences at the same time. It happens in the operating system when there are several process threads running in parallel.