Chapter use in real-time systems. Is it

Chapter 4: Threads

What resources are used when a thread is created? How do they differ
from those used when a process is created? (with a graphical illustration )

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

Creating a new thread doesn’t need any new resources but it needs the resources (memory) to be shared between process and threads. Creating a new process is consider as a heavyweight as new process needs new address space for the creation to be done and for sharing memory the communication of the process will be very expensive.

Which of the following components of program state are shared across
threads in a multithreaded process?
a. Register values b. Heap memory
c. Global variables d. Stack memory

Only heap memory and global variables are the shared.

Describe the actions taken by a kernel to context-switch between kernel levels
– Save data from CPU register of the current thread
– Restore registers of new thread
Provide three programming examples in which multithreading provides
Better performance than a single-threaded solution.
1. Running application in parallel
2. Web server
3. GUI

Assume that an operating system maps user-level threads to the kernel
using the many-to-many model and that the mapping is done through
LWPs. Furthermore, the system allows developers to create real-time
threads for use in real-time systems. Is it necessary to bind a real-time
thread to an LWP? Explain.

Yes it is necessary to bind a real thread

Consider the following code segment:

pid t pid;
pid = fork();
if (pid == 0) { /* child process */
thread create( . . .);

a. How many unique processes are created?
b. How many unique threads are created?
a. 6 processes b. 2 threads


I'm Owen!

Would you like to get a custom essay? How about receiving a customized one?

Check it out