Draw a tree of processes to illustrate the parent/child relationships between all of the processes created by fork when this program runs.

Exam #1 – Study Guide

1. List two goals that operating systems are designed to achieve?

2. Why do operating system’s make system calls available for use by programs?

3. What is a background service or daemon?

4. In the system call signature provided below, which parameter specifies the file it will read from? Explain what the parameter represents.

5. What are the three methods for passing parameters to the operating system when a system call is invoked? Briefly explain how each one works.

6. Why does kernel mode exist?

7. How is the separation of kernel mode from user mode enforced?

8. When your program makes a system call, what are the steps the OS goes through to complete it?

Processes 1. What is a process and how does it relate to a program?

2. What are the four components of a process in memory?

3. Can a program become multiple processes, explain?

4. What occurs during a context switch and what does it accomplish for the operating

system?

5. In Linux, what does the fork system call accomplish?

6. What is multitasking?

7. What data structure does the operating system use to store information about each

specific process? Identify a piece of information it contains and briefly explain its purpose.

8. What is inter-process communication (IPC)? Give two examples of IPC methods an

operating system might provide.

9. What are the two fundamental models of inter-process communication (IPC)? Briefly describe the attributes of each model.

10. What are cooperating processes and describe a situation where they would be used?

11. What are pipes and how are they used?

12. How do ordinary pipes differ from named pipes?

13. What are message queues?

14. How do synchronous system calls differ from asynchronous system calls?

15. Why is synchronization required when working with shared memory?

16. Circle the statements about inter-process communication (IPC) that are true • Accessing shared memory produces less overhead than message passing. • By their nature, message passing system calls are synchronous operations. • Writes to shared memory should be done within a critical section to protect the

consistency of the data. • IPC resources are automatically cleaned up by the operating system after all of the

processes using them have terminated. • Accessing shared memory should be synchronized to protect the consistency of

data.

17. Refer to this diagram when answering the questions that follow.

o The operating system structure represented by the diagram is called a __________________.

o These structures are managed in ______________ to facilitate their access to

I/O devices and processors.

o What is context switching and how are these structures involved?

18. Refer to this code snippet when answering the following questions. int main () { int some_number = 1; pid_t pid = fork (); if (pid == 0) { some_number = 0; if (fork () == 0) some_number = 3; } else if (pid > 0) { if (fork() == 0) { some_number = 2; } else cout << some_number; } return 0; }

a. Draw a tree of processes to illustrate the parent/child relationships between all of the processes created by fork when this program runs. (4 pts)

b. Is it possible to predict the value of some_number that is displayed on the terminal? If so, list the number; otherwise, explain why the value is unpredictable. (2 pts)

Threads 19. You get an awesome job writing software at Pixel Entertainment, a leading producer of

computer animated movies and games. You are tasked with writing a rendering algorithm, and quickly realize that by dividing the processing across multiple threads, you can take advantage of parallelism to reduce rendering times. Refer to this scenario, when answering the following questions:

a. Is this scenario an example of using threads to implement task parallelism?

b. At a meeting with the Product Owner, you learned your program will be bundled

with a tablet that is powered by a single processor (1 core). Will using multiple threads achieve parallelism on this device? Briefly explain.

c. Later, you receive an email about a change in plan. Your program will now be

shipped on another vendor’s tablet that is powered by a processor with 4 cores. When you read the tablet’s developer’s guide, you learn it runs an Unix like operating system that includes the vendor’s own version of the pthreads library that implements the many-to-one model. Can threads be used to achieve parallelism on this platform? Briefly explain.

d. Assume you chose not to use the 4 core tablet’s pthreads library, could parallelism

be achieved by dividing the work across multiple cooperating processes? Briefly explain.

20. Explain the difference between concurrency and parallelism?

21. Can parallelism be achieved on a single processor system? Explain.

22. Can concurrency be achieved on a single processor system? Explain.

23. How are data parallelism and task parallelism different?

24. Within a multithreaded process, some of the process’ resources are shared by all of the

threads. Circle the resources that are exclusive to each thread. o Register values

o Heap Memory o Code o Stack memory

25. Refer to this diagram when answering the following questions:

c. This is a diagram of the ____________ threading model.

d. In this model, if a user thread makes a blocking system call, are the other user threads able to do work while the system call is in progress? Briefly explain.

26. Refer to this diagram when answering the following questions:

user thread

kernel threadk

a. This is a diagram of the threading model. In this model, user threads are attached to kernel threads using intermediate data structures called .

b. In this model, if a user thread makes a blocking system call, are the other

user threads able to do work while the system call is in progress? Briefly explain.

27. Refer to this diagram when answering the following questions:

a. This is a diagram of the ____________ threading model.

user thread

kernel threadkkk

user thread

kernel threadkkkk

b. In this model, if a user thread makes a blocking system call, are the other user threads able to do work while the system call is in progress? Briefly explain.

c. Thread pools are often used with this model. What is a thread pool? Describe

one benefit they provide.

d. A limitation of this model is that it places an upper threshold on the number of threads an operating system can support. Can a thread pool help address this issue? Briefly explain.

28. When threads are applied correctly, your application can benefit in a number of ways. In the list below, cross out the two items that are not true benefits. • Responsiveness – may allow continued execution if part of process is blocked,

especially important for user interfaces • Resource Sharing – threads share resources of process, easier than shared memory

or message passing • Synchronization – unlike shared memory between processes, synchronization is not

required when threads share memory • Economy – cheaper than process creation, thread switching lower overhead than

context switching • Isolation – the execution of one thread cannot interfere with the execution of

another thread • Scalability – process can take advantage of multiprocessor architectures

"Looking for a Similar Assignment? Order now and Get a Discount!

Place New Order
It's Free, Fast & Safe

"Looking for a Similar Assignment? Order now and Get a Discount!

Hey, wait!You Don't want to miss this offer!

Before you go, let us offer you a 20% discount coupon for your next purchase.