Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
15 Cards in this Set
- Front
- Back
======== How many multiples of a single request can a single threaded server process at a time? |
It can only process one request at a time |
|
What is the following statement? for(;;){ receive(&client, request); process_request(...); send (client, reply); } |
it is a single threaded server |
|
What does a server do when it does not process client requests? |
1) nothing 2) it waits for client requests 3) it sleeps (blocked/sleep state) |
|
What problems do servers face? |
most client requests involve disk access, causing the server to remain in the WAITING state, in which it cannot handle other requests |
|
What are the +/-s of the following statement? int pid; for(;;){ recieve(&client, request); if((pid=fork())==0+{ process+request(...); send(client,reply); exit(0)}} Is there any solution that is better? Why not? |
+ the server can now handle serveral user requests in parellel - fork() is a very expensive system call there is a better solution! use a lightweight process or threads |
|
Why are lightweight processes and threads faster and cheaper? |
they share the address space of their parent, so there is no need to create a new address space, which is the most expensive step of a fork() system call |
|
Is it dangerous to use lightweight processes? |
It is dangerous... 1) no memory protection within address space 2) lightweight processes can interfere with each other but.... all lightweight process code is written by the same team |
|
Describe the 3 key traits of a thread/lightweight process. |
1) does not have its own address space 2) shares address space with parent and other peer threads in same space (task) 3) each has its own program counter, set of registers, and its own stack |
|
How are threads and light weight processes implemented? What mistake will cause your computer to become engulfed in flames? |
They are imlemented with: 1) Kernel support (mach, linux, windows NT) 2) user level (pthread library) throwing your computer into a smoldering trash can is a mistake. |
|
What are kernel supported threads managed through? |
system calls |
|
How many process tables exist for each thread? |
wrong question! only one process table ENTRY exists per thread |
|
Why are kernel supported threads the best solution for multiprocessor architectures? |
because a kernel can allocate several processor to a single multi-threaded task |
|
What performance issues can arise when using kernel supported threads? |
switching between two threads in the same task involves a system call which results in two context switches |
|
Given the following statement, describe the function of each argument: clone(fn,stack,flags) |
fn: specifies function to be exewcuted by new thread or process stack: points to the stack it will use flags: is a set of flags specifying various options |
|
What is CLONE_VM? What is it needed for? What if it is absent? |
It is a flag. it is needed to clone a thread if it is absent linux creates a regular process with its own address space |