-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
64 lines (51 loc) · 2.28 KB
/
Copy pathREADME
File metadata and controls
64 lines (51 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
yali.ekstein, omer.holtzman
Yali Ekstein (212537807), Omer Holtzman (212422794)
EX: 2
FILES:
thread.cpp -- thread class for managing single thread data and actions.
thread.h -- header file for the class above ^.
uthreads.cpp -- implementation of the library.
README -- this file - answers to theoretical part.
REMARKS:
We just wanted you to know that we worked REALLY hard about this exercise.
Including debbuging in Passover cause thing went bad. But now we are better.
sorry for the late submission.
1. Answer:
Example of user-level treads use:
A web server that has many clients. each clients has his requests and the
different processes can synchronize their activity without us implementing the
synchronization.
The web server can open as many user-level threads as he likes (There can be
many clients).
The overhead of user-level threads is low - we can easily switch between them,
create them and close them.
2. Answer:
The Advantages of creating new processes:
* Processes are more protected one from the another. They talk to each other
through the OS. (protected in case of data)
* (Against user-level threads: ) if one thread is blocked all other user-level
threads are blocked too.
The Disadvantages of creating new processes:
* Processes has high overhead -> creation, termination and switching between
threads is way slower.
* Threads can communicate easily -> sharing data is easier.
3. Answer:
-> user input:
interrupt caused by us typing down on the keyboard.
The interrupt is handled by the OS. and sends a TERM signal to the process.
(a step in the middle -> there should be a signal to the displaying shell to
show the typed letters. The process is handles the signal)
-> Termination signal: (command execution)
signal that is sent by the OS to the shotwell's process.
some interrupt is sent back to our CPU.
-> CPU handles the interrupt
-> CPU sends signal to the display
the display shell has signal handler which handles the signal and displays
"Terminated".
4. Answer:
Virtual time -> the time takes to the CPU to execute a mission
Real time -> the time that takes to execute the mission plus the interrupts
that comes when the mission is executed.
5. Answer:
sigsetjmp -> saves the current location, CPU state and signal mask
siglongjmp -> restores the saved location, state of the CPU and signal mask