Saturday, January 21, 2012

Request kernel to create new process


Kernel is the layer of interface to Core hardware. Kernel function calls System call.
  1. System initialization (memory space, address initialization)
  2. Execution of the process creation system calls also cause process creation (Exec() – once running as a process, user program can invoke the system call – Exec to create a new child process executing another user program.)
  3. User request to create a new process (i.e. fork())
  4. Initiation of batch job creates new process

Swap and its role in resource sharing


Swap is a mechanism to coordinate process to share main memory efficiently, and make processor busy. It helps to achieve high performance.

Role in resource sharing
Process normally swapped out from main memory to disk, or from disk to main memory.  Swap is a way for OS to provide more memory than is what physically available by keeping the portions of the primary memory in secondary storage. It allows more tasks to be loaded in memory at the same time. It goes well with multitasking systems, and allows another process to run when the running process need to wait for some portion of memory to be reloaded from secondary storage like disk, or extended memory.
Describe timeout interrupt and its role in resource sharing

Timeout interrupt
Timeout interrupt is signal generated by operation system to invoke any threads waiting on clock tick after particular set time interval.

Role in resource sharing
It’s one of the signal with highest priority, so current running threads are suspended and any thread which are waiting for this signal or thread which are suppose to get access to resource gets priority to access it. Its used by kernel process scheduler, for context switching.

Source: Wiki, OS books, case study

Shared memory


Shared memory is piece of memory which can be accessed simultaneously by multiple programs with an ability to provide inter communication among them with avoiding redundant copies.
It is large block of random access memory that can be accessed by several different CPUs in multi process computer system. All the processors share a single view of data and the communication between processors can be as fast as memory accesses to a same location.

It allows inter process communication, process can create area in RAM which other process can access. When one memory location gets updated with some information by processor, change needs to be reflected to the other processors. It can create the data discrepancy, if the access in controlled properly (concurrency needs to be maintained by different means of methods).

Since multiple processes can access the shared area like normal memory, it will allow fast communication. Dynamic libraries are generally held in memory once mapped to different processes, and paging gets done based on individual process starts accessing. Based on number of process accesses different copies gets generated and maintained in shared space. Upon writing to each, it writes to local copy and then the main copy gets updated.

References - Wiki, OS