Sockets, Threads and Resource Locking Flashcards

1
Q

What does a socket allow?

A

A socket allows for two nodes on a network to talk to each other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the advantages of threads over a forked process?

A

They are faster to create, switch between, and communicate between.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are threads implemented in C?

A

They are not supported by language standard but are provided by POSIX in the form of pthreads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is mutex used for?

A

locking and unlocking a resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does a Semaphore do?

A

It is a signalling mechanism that protects a resource from being overwritten.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is the Semaphore implemented?

A

If the Semaphore count is 0 then the thread waits until it isn’t to access the resource. The count is incremented and decremented as resources are accessed and released.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly