CSCI 1730 FINAL (LAMARCA) QUESTIONS
What is concurrency? State some different examples of concurrency in systems
programming. - Answer -concurrency - when two or more3 things are executing at the
same time. Examples of concurrency - bash, operating system, emacs, user programs,
signals, pipes, File I/O, and sockets.
How does a C programmer write a single program that can exhibit concurrent behavior?
What system calls are involved in creating a process that exhibit concurrent behavior? -
Answer -the user can call fork or use a pthread in a single program. System calls: fork()
and pthread()
What is IPC? How does IPC relate to systems programming and concurrency? -
Answer -IPC - inter-process communication. It allows the programmer to coordinate
activities among various program processes which can run concurrently in a OS
What system calls are used in network IPC and concurrency? - Answer -system calls:
socket(), bind(), listen(), accept(), connect(), send(), recv(), close()
What is a thread? Why is a thread also called a lightweight process? - Answer -A
thread is a way for a program to divide into itself into two or more simultaneously
running tasks. Sometimes called lightweight processes because they have their own
stack but can access shared data.
what is the difference between a multi-threaded process and a process that forks into a
child and parent process? - Answer -Threading runs multiple line of execution
intraprocesses. Forking is a means of creating new processes.
What system calls are associated with pthreads? - Answer -system calls:
pthread_self(), pthread_equal(), pthread_create(), pthread_exit(), pthread_join(),
what is a signal handler and when are they used? - Answer -signal handler - a function
which is called when the target environment when the corresponding signal occurs
what system calls are associated with sockets? - Answer -system calls:
what is an active participant? - Answer -client
what is a passive participant? - Answer -server
What system calls does a passive participant typically call that an active participant may
not typically call. - Answer -listen() and accept()
, Do concurrent processes need to be run on the same machine? - Answer -no
Suppose computer A is running process B and computer C is running process D. also
suppose A and C are different computers running different hardware and B & C are
running concurrently. Can IPC be established between be and D. So then, what system
calls are typically involves in the IPC between B and C? If not, explain why B and C
cannot establish IPC? - Answer -
what system calls are used to handle the IPC between the two processes in the
command below
? ls | grep *.c - Answer -
what is section 1 of the manual pages on odin used for? - Answer -Applications
what is section 2 of the manual pages on odin used for? - Answer -system calls
what is section 3 of the manual pages on odin used for? - Answer -library functions
When reading a manual page on odin, how do you know what section you are in? -
Answer -
what is the difference between a library function call and a system function call? -
Answer -system call - a call made by the program to enter into kernel mode to access a
process
function call - made by the program to access a library function defined in a
programming library
what are the functions htonl(...) and ntohl(...) used for? Why are they typically used? -
Answer -htonl() - takes a 32-bit number in host byte order and returns a 32-bit number
in the network byte order
ntohl()- converts the unsigned integer netlong from network byte order to host byte
order.
used in TCP/IP networks, do nothing on big-endian, on little-endin they reverse the byte
order,
used for machines to communicate with each other over the network
In C++, what is the difference between pass by value and pass by reference? - Answer
-pass by value only passes a copy of a variable. meanwhile pass by refernce actually
passes the variable allowing it to be changed.
Does C have pass by reference? if not, how do we use pass by value to simulate pass
by reference behavior in C? - Answer -No. You can use dereferenced pointers as
arguments in the function definition. Also use the 'address of' (&) operator on the
variables when calling the functions
What is concurrency? State some different examples of concurrency in systems
programming. - Answer -concurrency - when two or more3 things are executing at the
same time. Examples of concurrency - bash, operating system, emacs, user programs,
signals, pipes, File I/O, and sockets.
How does a C programmer write a single program that can exhibit concurrent behavior?
What system calls are involved in creating a process that exhibit concurrent behavior? -
Answer -the user can call fork or use a pthread in a single program. System calls: fork()
and pthread()
What is IPC? How does IPC relate to systems programming and concurrency? -
Answer -IPC - inter-process communication. It allows the programmer to coordinate
activities among various program processes which can run concurrently in a OS
What system calls are used in network IPC and concurrency? - Answer -system calls:
socket(), bind(), listen(), accept(), connect(), send(), recv(), close()
What is a thread? Why is a thread also called a lightweight process? - Answer -A
thread is a way for a program to divide into itself into two or more simultaneously
running tasks. Sometimes called lightweight processes because they have their own
stack but can access shared data.
what is the difference between a multi-threaded process and a process that forks into a
child and parent process? - Answer -Threading runs multiple line of execution
intraprocesses. Forking is a means of creating new processes.
What system calls are associated with pthreads? - Answer -system calls:
pthread_self(), pthread_equal(), pthread_create(), pthread_exit(), pthread_join(),
what is a signal handler and when are they used? - Answer -signal handler - a function
which is called when the target environment when the corresponding signal occurs
what system calls are associated with sockets? - Answer -system calls:
what is an active participant? - Answer -client
what is a passive participant? - Answer -server
What system calls does a passive participant typically call that an active participant may
not typically call. - Answer -listen() and accept()
, Do concurrent processes need to be run on the same machine? - Answer -no
Suppose computer A is running process B and computer C is running process D. also
suppose A and C are different computers running different hardware and B & C are
running concurrently. Can IPC be established between be and D. So then, what system
calls are typically involves in the IPC between B and C? If not, explain why B and C
cannot establish IPC? - Answer -
what system calls are used to handle the IPC between the two processes in the
command below
? ls | grep *.c - Answer -
what is section 1 of the manual pages on odin used for? - Answer -Applications
what is section 2 of the manual pages on odin used for? - Answer -system calls
what is section 3 of the manual pages on odin used for? - Answer -library functions
When reading a manual page on odin, how do you know what section you are in? -
Answer -
what is the difference between a library function call and a system function call? -
Answer -system call - a call made by the program to enter into kernel mode to access a
process
function call - made by the program to access a library function defined in a
programming library
what are the functions htonl(...) and ntohl(...) used for? Why are they typically used? -
Answer -htonl() - takes a 32-bit number in host byte order and returns a 32-bit number
in the network byte order
ntohl()- converts the unsigned integer netlong from network byte order to host byte
order.
used in TCP/IP networks, do nothing on big-endian, on little-endin they reverse the byte
order,
used for machines to communicate with each other over the network
In C++, what is the difference between pass by value and pass by reference? - Answer
-pass by value only passes a copy of a variable. meanwhile pass by refernce actually
passes the variable allowing it to be changed.
Does C have pass by reference? if not, how do we use pass by value to simulate pass
by reference behavior in C? - Answer -No. You can use dereferenced pointers as
arguments in the function definition. Also use the 'address of' (&) operator on the
variables when calling the functions