Operating System Assignment 2
Exercise 3
- Using the program shown in Figure 3.30, explain what the output will be at Line A.
- The output of this program will be 5 al line A. Because the child process updates only its copy of value and it returns that value to the parent process which is 5.
- Including the initial parent process, how many processes are created by the program shown in Figure 3.31?
- In this program fork() function called three times, and whenever a fork() function called, it will create child nodes process of a binary tree. So, there are 8 process created here.
- Original versions of Apple’s mobile iOS operating system provided no means of concurrent processing. Discuss three major complications that concurrent processing adds to an operating system.
- Switching from one process to another process leads to time overhead this requires storing the current register values and loading the register values of the next process from its program Control Block.
- The OS must keep track of the main memory address space allocated to each process so that a process does not affect or harm other processes data.
- If a running process requires large space in memory, then other process needs to be dumped back to hard disk which again leads to time overhead.
- When a process creates a new process using the fork() operation, whichof the following states is shared between the parent process and the child process?
- Stack
- Heap
- Shared memory segments
- Shared memory segments. When a process uses the fork() to create a new process, all the new processes corresponding to the parent process are created and loaded into a separate memory location for the child process by the operating system. Only the shared memory segments are shared between the parent process and the newly forked child process.
Exercise 4
- Provide two programming examples in which multithreading provides better performance than a single-threaded solution.
- In GUI, different threads are executed for the multiple task. Such as to fix the bugs, for the execution of the program and for the better performance of the program.
- In a web server, number of users request for the application. Therefore, number of different threads are executed for different users.
- Describe the actions taken by a kernel to context-switch between kernel level threads.
- Kernel is the head of any OS. And several threads are executed by the kernel with different tasks. Also, interrupts of multi threads are control but kernel.
- For the kernel, the execution time is the main issue.
- Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled.
- Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution.
- Any kind of sequential program is not a good candidate to be threaded. An example programs like this are sorting numbers, computing the factorial of a number, and minimize the linear equation which gives better performance if it uses the single thread.
- Another example is a "shell" program such as the C-shell or Korn shell. The shell programs use the single thread to execute the program.
Exercise 5
- Explain why Windows, Linux, and Solaris implement multiple locking mechanisms. Describe the circumstances under which they use spinlocks, mutex locks, semaphores, adaptive mutex locks, and condition variables. In each case, explain why the mechanism is needed.
- These operating systems provide different locking mechanisms depending on the application developers' needs.
- Spin locks are useful for multiprocessor systems where a thread can run in a busy-loop, for a short period of time, rather than incurring the overhead of being put in a sleep queue.
- Mutexes are useful for locking resources. Solaris 2 uses adaptive mutexes, meaning that the mutex is implemented with a spin lock on multiprocessor machines.
- Semaphores and condition variables are more appropriate tools for synchronization when a resource must be held for a long period of time, since spinning is inefficient for a long duration.
- What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answer.
- Busy waiting means that a process is waiting for a condition to be satisfied in a tight loop without relinquishing the processor. It checks the act of CPU for the critical section entry.
- Busy waiting can be overcome by a wait() and signal() semaphore operation.
- A process could wait by relinquishing the processor, and block on a condition and wait to be awakened at some appropriate time in the future.
- Busy waiting can be avoided but incurs the overhead associated with putting a process to sleep and having to wake it up when the appropriate program state is reached.
- The first known correct software solution to the critical-section problem for two processes was developed by Dekker. The two processes, P0 and P1, share the following variables:
boolean flag[2]; /* initially false */
int turn;
The structure of process Pi (i == 0 or 1) is shown in Figure 5.21. The other process is Pj (j == 1 or 0). Prove that the algorithm satisfies all three requirements for the critical-section problem.
- Mutual exclusion is ensured using the flag and turn variables. If both processes set their flag to true, only the process whose turn it will succeed. The waiting process can only enter its critical section when the other process updates the value of turn.
- Progress is provided through the flag and turn variables. If the process tries to access the critical section, it can set their flag variable to true and enter their critical section. The next time process try to enter its critical section, it repeats the process of entering its critical section and setting turn to the other process upon exiting.
- Bounded waiting is preserved using the turn variable. Suppose two processes wants to enter to their respective critical sections. They both set their value of flag to true. But only the thread whose turn it is can proceed and the other thread waits. If bounded waiting were not preserved, it would therefore be possible that the waiting process would have to wait indefinitely while the first process repeatedly entered its critical section.
Buy Operating System Assignment 2 Answers Online
Talk to our expert to get the help with Operating System Assignment 2 to complete your assessment on time and boost your grades now
The main aim/motive of the management assignment help services is to get connect with a greater number of students, and effectively help, and support them in getting completing their assignments the students also get find this a wonderful opportunity where they could effectively learn more about their topics, as the experts also have the best team members with them in which all the members effectively support each other to get complete their diploma assignments. They complete the assessments of the students in an appropriate manner and deliver them back to the students before the due date of the assignment so that the students could timely submit this, and can score higher marks. The experts of the assignment help services at urgenthomework.com are so much skilled, capable, talented, and experienced in their field of programming homework help writing assignments, so, for this, they can effectively write the best economics assignment help services.
Get Online Support for Operating System Assignment 2 Assignment Help Online
Resources
- 24 x 7 Availability.
- Trained and Certified Experts.
- Deadline Guaranteed.
- Plagiarism Free.
- Privacy Guaranteed.
- Free download.
- Online help for all project.
- Homework Help Services
Testimonials
Urgenthomework helped me with finance homework problems and taught math portion of my course as well. Initially, I used a tutor that taught me math course I felt that as if I was not getting the help I needed. With the help of Urgenthomework, I got precisely where I was weak: Sheryl. Read More