Showing posts with label os_4. Show all posts
Showing posts with label os_4. Show all posts

Thursday, July 30, 2009

Enter process communication

1.direct communication
–each process wanting to communicate must explicitly name the recipient or sender of the communication
–send and receive primitives defined:
send ( P, message ) : send a message to process P
receive ( Q, message ) : receive a message from process Q


2.indirect communication - messages sent to and received from mailboxes (or ports) »mailboxes can be viewed as objects into which messages placed by processes and from which messages can be removed by other processes
–each mailbox has a unique ID
–two processes can communicate only if they have a shared mailbox

send ( A, message ) : send a message to mailbox A receive
receive ( A, message ) : receive a message from mailbox A

3. synchronization -
send and receive operations blocking
»sender is suspended until receiving process does a corresponding read

»receiver suspended until a message is sent for it to receive

  • blocking send - when a process sends a message it blocks until the message is received at the destination.
  • non blocking send - After sending a message the sender proceeds with its processing without waiting for it to reach the destination.
  • blocking receive - When a process executes a receive it waits blocked until the receive is completed and the required message is received.
  • non blocking receive - The process executing the receive proceeds without waiting for the message(!).

4. Buffering - the number of messages that can reside in a link temporarily

  • Zero capacity - queue length 0 »sender must wait until receiver ready to take the message
  • Bounded capacity - finite length queue »messages can be queued as long as queue not full »otherwise sender will have to wait
  • Unbounded capacity »any number of messages can be queued - in virtual space? »sender never delayed

5. Producers – Binary semaphores : one message token –General (counting) semaphores : more than one message token –message blocks used to buffer data items –scheme uses two mailboxes »mayproduce and mayconsume

–producer :

»get a message block from mayproduce

»put data item in block

»send message to mayconsume


–consumer :

»get a message from mayconsume

»consume data in block

»return empty message block to mayproduce mailbox

Thursday, July 16, 2009

chapter 4

5.) interprocess communication - Inter-process communication
(IPC) is a set of techniques for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary based on the bandwidth and latency of communication between the threads, and the type of data being communicated.

There are several reasons for providing an environment that allows process cooperation:

  • Information sharing
  • Computation speedup
  • Modularity
  • Convenience

4. cooperating process

a.) An independent process cannot affect or beaffected by the execution of another process.

b. ) A cooperating process can affect or be affected bythe execution of another process

c. ) Advantages of process cooperation

  • Information sharing
  • Computation speed-up
  • Modularity
  • Convenience

chapter 4

1.The concept of process

a.)process state- the stage of execution that a process is in. It is these states which determine which processes are eligible to receive CPU time.




  • since there is a single processor,at ant time,there will be at most one process running. We will call this the current proccess.

  • There may be several processess that are waiting to use the processor. These processess are sais to be ready.

  • There may be some that are waiting, not for the processor, dut for a different resource or event. These process said to be block.

b.)process control- The collection of attributes is refereed to as process control block.
A Process Control Block (PCB, also called Task Control Block or Task Struct) is a data structure in the operating system kernel containing the information needed to manage a particular process. The PCB is "the manifestation of a process in an operating system".

Included information

Implementations differ, but in general a PCB will include, directly or indirectly:
  • The identifier of the process (a process identifier, or PID)
  • Register values for the process including, notably, the Program Counter value for the process
  • The address space for the process
  • Priority (in which higher priority process gets first preference. eg., nice value on Unix operating systems)
  • Process accounting information, such as when the process was last run, how much CPU time it has accumulated, etc.
  • Pointer to the next PCB i.e. pointer to the PCB of the next process to run
  • I/O Information (i.e. I/O devices allocated to this process, list of opened files, etc)

During a context switch, the running process is stopped and another process is given a chance to run. The kernel must stop the execution of the running process, copy out the values in hardware registers to its PCB, and update the hardware registers with the values from the PCB of the new process.

c.)threads-A thread (or lightweight process) is a basic unit of CPU utilization; it consists of:) program counter) register set ) stack spaceA thread shares with its peer threads its:) code section) data section) operating-system resourcescollectively know as a task.A traditional or heavyweight process is equal to a task with one thread


operating system - 4

2.Process scheduling

a.) scheduling queues - Queue scheduling mechanism in a data packet transmission system:::::
A queue scheduling mechanism in a data packet transmission system, the data packet transmission system including a transmission device for transmitting data packets, a reception device for receiving the data packets, a set of queue devices respectively associated with a set of priorities each defined by a priority rank for storing each data packet transmitted by the transmission device into the queue device corresponding to its priority rank, and a queue scheduler for reading, at each packet cycle, a packet in one of the queue devices determined by a normal priority preemption algorithm. The queue scheduling mechanism includes a credit device that provides at each packet cycle a value N defining the priority rank to be considered by the queue scheduler whereby a data packet is read by the queue scheduler from the queue device corresponding to the priority N instead of the queue device determined by the normal priority preemption algorithm

b.)schedulers - The scheduler is the component of an operating system that determines which process should be run, and when.

We will specify:

  • The service provided-the scheduler specification
  • A system that provides this services-the scheduler implementation

c.)context switch - Execution context is determined by the user or login connected to the session, or executing (calling) a module. It establishes the identity against which permissions to execute statements or perform actions are checked. In SQL Server, the execution context can be switched to another user or login by executing the EXECUTE AS statement, or specifying the EXECUTE AS clause in a module. After the context switch, SQL Server checks permissions against the login and user for that account instead of the person calling the EXECUTE AS statement or the module. The database user or SQL Server login is impersonated for the remainder of the session or module execution, or until the context switch is explicitly reverted. For more information about execution context, see Understanding Execution Context.


Explicit Context Switching

The execution context of a session or module can be explicitly changed by specifying a user or login name in an EXECUTE AS statement. The impersonation remains in effect until one of the following events occurs:

  • The session is dropped.
  • Context is switched to another login or user.
  • Context is reverted to the previous execution context.

OPERATING SYSTEM

3.Operation processess


a.) process creation - Process creation in UNIX
The seven-state logical process model we considered in a previous lecture can accommodate the UNIX process model with some modifications, actually becoming a ten state model.
First, as we previously observed, UNIX executes most kernel services within a process's context, by implementing a mechanism which separates between the two possible modes of execution of a process. Hence our previously unique ``Running'' state must actually be split in a ``User Running'' state and a ``Kernel Running'' state. Moreover a process preemption mechanism is usually implemented in the UNIX scheduler to enforce priority. This allows a process returning from a system call (hence after having run in kernel mode) to be immediately blocked and put in the ready processes queue instead of returning to user mode running, leaving the CPU to another process. So it's worth considering a ``Preempted'' state as a special case of ``Blocked''. Moreover, among exited processes there's a distinction between those which have a parent process that waits for their completion (possibly to clean after them), and those which upon termination have an active parent that might decide to wait for them sometime in the future (and then be immediately notified of its children's termination) . These last processes are called ``Zombie'', while the others are ``Exited''. The difference is that the system needs to maintain an entry in the process table for a zombie, since its parent might reference it in the future, while the entry for an exited (and waited for) process can be discarded without further fiddling. So the much talked about ``Zombie'' processes of UNIX are nothing but entries in a system table, the system having already disposed of all the rest of their image. This process model is depicted in fig. 5.





b.)process termination - Processes terminate in one of two ways:

  • Normal Termination occurs by a return from main or when requested by an explicit call to exit or _exit.
  • Abnormal Termination occurs as the default action of a signal or when requested by abort