Tuesday, April 10, 2012

Processes


  • Processes

A process is an instance of a program in execution.

Process in the memory is divided into four sections

The text section comprises the compiled program code, read in from non-volatile storage when the program is launched.
The data section stores global and static variables, allocated and initialized prior to executing main.
The heap is used for dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc.
The stack is used for local variables

http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html


  • Processes - Part I

http://www.youtube.com/watch?v=TIa2mhKCeYo&feature=related

what is a process?
an instance of a computer program in execution
can have several threads
each process has its own state,address and space

process in memory
-stack(local function variables)
-heap(memory allocated directly by a program)
-shared variables
-global variables
-text(program code converted to machine instructions)

process states
-new
-ready
-running
-waiting
-terminated



  • Processes - Part II

http://www.youtube.com/watch?v=_5EV7isUJ6k&feature=relmfu

  • process are created by system call fork() on unix-like systems

exec system call
fork system call

child process that run in the background after parent process terminates are

In Linux we can set guidelines for the CPU to follow when it is looking at all the tasks it has to do. These guidelines are called niceness or nice value. The Linux niceness scale goes from -20 to 19. The lower the number the more priority that task gets. If the niceness value is high number like 19 the task will be set to the lowest priority and the CPU will process it whenever it gets a chance. The default nice value is zero.

By using this scale we can allocate our CPU resources more appropriately. Lower priority programs that are not important can be set to a higher nice value, while high priority programs like daemons and services can be set to receive more of the CPU’s focus. You can even give a specific user a lower nice value for all of his/her processes so you can limit their ability to slow down the computer’s core services.

https://www.nixtutor.com/linux/changing-priority-on-linux-processes/called demon processes

  • Linux Kernel schedules the process and allocates CPU time accordingly for each of them. But, when one of your process requires higher priority to get more CPU time, you can use nice and renice command
A nice value of -20 represents highest priority, and a nice value of 19 represent least priority for a process.
By default when a process starts, it gets the default priority of 0.
https://www.thegeekstuff.com/2013/08/nice-renice-command-examples/?utm_source=tuicool
  • A Vanilla Kernel is the official Kernel released on http://www.kernel.org/. It is a standard release, ?gzipped tar kernel file, from kernel.org.
https://wiki.debian.org/vanilla

  • The kernels at www.kernel.ORG are vanilla kernels.
Each different distribution takes these vanilla kernels and adds their own type of flavoring. They may fix particular bugs in the code (Debian is very good at doing this), and they may add their own patches to do fancy things (SuSE adds a patch to do a boot screen animation), and they may add patches to enhance the facilities of the kernel (often using the source from the developmental branch of the kernel eg for very new USB devices).Thus, although all kernels are derived from the same kernel source, not all kernels are equal.
https://www.linuxquestions.org/questions/linux-general-1/what-is-vanilla-kernel-79388/


No comments:

Post a Comment