Question

Q.6. Consider a preemptive operating system where processes have priorities and a running process gets preempted (i.e., force

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Before going into the life cycle of process we need to know about what process is. So When we write any instruction into any environment then it will must go for execution, so when an instruction is in execution state then it is called process.

If we talk about the life cycle of process, As a process executes,it changes state. The state of a process is defined in part by the current activity of that process. A process may be in one of the following states:
• New. The process is being created.

• Running.Instructions are being executed

• Waiting. The process is waiting for some event to occur (such as an I/O completion or reception of a signal).

• Ready. The process is waiting to be assigned to a processor

• Terminated. The process has finished execution.

The main priority is to maximize the CPU utilization, for this OS system enable concurrent access the critical section where the process are sharing something let say variables. For concurrent accessing of critical section, process should be preemptive so that other process can execute if any process is taking more time or any process moves for input/output operations then other process can execute their instructions. Suppose of one process let say p1 is currently executing in critical section in CPU, let say high priority process p2 came there then p1 will get preempt and high priority process will execute.

In priority scheduling algorithm in os, The SJF(shortest job first) algorithm is a special case of the general priority-scheduling algorithm. Apriority is associated with each process, and the CPUis allocated to the process
with the highest priority. Equal-priority processes are scheduled in FCFS order. An SJF algorithm is simply a priority algorithm where the priority (p) is the inverse of the (predicted) next CPU burst. The larger the CPU burst, the lower the priority, and vice versa.

Priority scheduling can be either preemptive or non-preemptive. When a process arrives at the ready queue, its priority is compared with the priority of the currently running process. A preemptive priority scheduling algorithm
will preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running process. A non-preemptive priority scheduling algorithm will simply put the new process at the head of the ready
queue.

In various case we may face the deadlock situation. A set of processes is in a deadlocked state when every process in the set is waiting for an event that can be caused only by another process in the set. The events with which we are mainly concerned here are resource acquisition and release. The resources may be either physical resources (for example, printers, tape drives, memory space, and CPU cycles) or logical resources (for example, semaphores, mutex locks, and files). However, other types of events may result
in deadlocks. let say example consider a system with one printer and oneDVDdrive. Suppose that process Pi is holding the DVD and process Pj is holding the printer. If Pi requests the printer and Pj requests the DVD drive, a deadlock occurs. for removing these issue we have various deadlock handling algorithms are designed.

A process also have suspend properties by which any high priority process can suspend the low priority process through the suspend(process_id) and then again that process can resume their task. let say in Linux system

You can use kill to stop the process.

For a 'polite' stop to the process (prefer this for normal use), send SIGTSTP:

kill -TSTP [pid]

For a 'hard' stop, send SIGSTOP:

kill -STOP [pid]

Note that if the process you are trying to stop by PID is in your shell's job table, it may remain visible there, but terminated, until the process is fg'd again.

To resume execution of the process, sent SIGCONT:

kill -CONT [pid].

A message queue is a linked list of messages stored within the kernel and identified by a message queue identifier. A new queue is created or an existing queue opened by msgget().
New messages are added to the end of a queue by msgsnd(). Every message has a positive long integer type field, a non-negative length, and the actual data bytes (corresponding to the length), all of which are specified to msgsnd() when the message is added to a queue. Messages are fetched from a queue by msgrcv(). We don’t have to fetch the messages in a first-in, first-out order. Instead, we can fetch messages based on their type field.

All processes can exchange information through access to a common system message queue. The sending process places a message (via some (OS) message-passing module) onto a queue which can be read by another process. Each message is given an identification or type so that processes can select the appropriate message. Process must share a common key in order to gain access to the queue in the first place.

Add a comment
Know the answer?
Add Answer to:
Q.6. Consider a preemptive operating system where processes have priorities and a running process gets preempted...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 10) Unlike a signal, which conveys only the occurrence of a particular event and contains no...

    10) Unlike a signal, which conveys only the occurrence of a particular event and contains no information content, a pipe can be thought of as a scratch file created by a system call. It can be used as a communications channel between concurrently running processes. The interface call to a pipe is similar to that for any file. In fact, the process reads and writes to a pipe just like any file. Unlike files, however, pipes do not represent actual...

  • Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of...

    Using the book, write another paragraph or two: write 170 words: Q: Compare the assumptions of physician-centered and collaborative communication. How is the caregiver’s role different in each model? How is the patient’s role different? Answer: Physical-centered communication involves the specialists taking control of the conversation. They decide on the topics of discussion and when to end the process. The patient responds to the issues raised by the caregiver and acts accordingly. On the other hand, Collaborative communication involves a...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT