exam 2 practice Flashcards
Say the critical section is protected by the exitSemaphore. When a thread finishes its critical section, it signals this by calling sem_post(&exitSemaphore)
true or false
true
The ___________ function is used to create a socket (communication endpoint) and returns a file descriptor that can be used for further socket operations.
socket()
After a successful dup2() call, what is the relationship between oldfd and newfd?
They refer to the same file
When is atomicity guaranteed for the write() operation?
For requests with a size typically around 4096 bytes or less
What does the pipe() system call return if an error occurs during its execution?
-1
What is the general syntax of the pipe() system call?
int pipe(fd[2]);
fputc() is used for buffered character output (it writes a character to a specified file stream and allows buffering for improved performance) but putc() is a more general function and can be used for unbuffered character output or buffered character output depending on the file stream
true or false
True
Why is the gets(theBuffer) function considered a high-security risk?
It can overwrite memory and lead to buffer overflow vulnerabilities.
A thread can be bound to multiple processes.
False
In blocking I/O, a program waits for the operation to complete and can be delayed, potentially causing slower performance.
True
After a successful call to execv (Select all that apply)
-instructions are executed at the beginning of main()
-an executable specified as an argument to execv is loaded
A deadlock might occur when one thread tries to send a message from user A to user B while another tries to send a message from user B to user A
True
____________ and ____________ are custom signals that can be used for user-defined purposes, such as triggering specific actions within a process.
SIGUSR1 and SIGUSR2
ssh and http can be implemented using this socket type.
a connection-oriented socket like TCP
Select the true statements about stream sockets
-Data arrives in the form of a byte-stream
-Receiver needs to separate messages in stream
-There is no requirement to segment the data into packets.
-Data transfer happens using send() and recv() functions