CSCE3600 - Exam 2 Flashcards

1
Q

an independent stream of instructions that can be scheduled to be run by the OS

A

thread

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

a program with multiple streams

A

multithreading

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

threads share…

A

memory and files with other threads that are in the same process

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

ownership of memory, files, and other resources

A

process

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

makes shell

A

system()

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

initiate new programs and replaces this process with a new one

A

exec()

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

creates new process, start a concurrent process, creates a child process by making copy of parent

A

fork()

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

two reasons for fork to fail

A

too many processes in the system

total number of processes exceeds system’s limit

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

semaphores can be initialized to….

A

any value

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

semaphores are used for

A

pthread blocking

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

if semaphore value is less than or equal to zero…

A

threads are blocked

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

if semaphore value is greater than zero

A

blocked threads wake up

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

when multiple processes use shard data and final outcome depends on order in which processes run

A

race conditions

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

creates a thread

A

pthread_create

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

set thread to release

A

pthread_detach

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

test two thread IDs for equality

A

pthread_equal

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

exit a thread without exiting process

A

pthread_exit

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

send a signal to a thread

A

pthread_kill

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

wait for a thread

A

pthread_join

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

find out own thread ID

A

pthread_self

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

allow threads to synchronize based upon the actual value of data

A

condition variables

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

explicit queue that threads can put themselves in when state of execution is not desired

A

waiting on a condition

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

another thread can wake up one/more waiting threads to allow them to continue

A

signaling on a condition

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

a per-process, unique, nonnegative integer used to identify an open file for the purpose of file access

A

file descriptors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
each file descriptor refers to exactly _____ open file descriptors but an open file description may be referred to by _____ than _____ file descriptor
one, more, one
26
specification whether the file can be read and written
file access modes
27
the byte position in the file where the next I/O operation through that open file description begins
file offset
28
append mode or not blocking/non-blocking
file status includes
29
creates a copy of the file descriptor oldfd
dup()
30
makes newfd be the copy of oldfd closing newfd first if necessary
dup2()
31
used only with related processes: parent/child child/child
unnamed pipes
32
exists only as long as the processes using it are alive
unnamed pipes
33
redirects input from a file
34
redirects output to a new file
>
35
redirects output and appends the data to a current file or creates if file doesn't exist
>>
36
both processes on same machine
UNIX domain
37
processes on different machine
INET domain
38
provides sequenced, reliable, two-way, connection-based byte streams (telnet, ssh, http)
SOCK_STREAM
39
supports datagrams (connectionless, unreliable messages of a fixed maximum length
SOCK_DGRAM
40
exec() returns _____ on error
-1
41
socket >> bind >> listen >> accept >> close
steps in server process
42
socket >> set up sockaddr_un >> connect >> send and recv >> close
steps in client process
43
little-endian reads _________ first
high-order (first 8 bits)
44
big-endian reads __________ first
low-order (last 8 bits)
45
well-known ports, reserved by IANA
ports 0-1023
46
registered ports
ports 1024-49151
47
dynamic ports, OS use randomly
ports 49,152-65,535
48
identifies a single host, variable length string (www.unt.edu)
hostname
49
written as dotted octets, 32 bits
IP address
50
identifies a process on a host, 16 bit number
port number
51
socket() >> sendto() (data request() >> recvfrom() >> close()
UDP Client flow
52
socket() >> bind() >> recvfrom() >> sendto()
UDP Server flow
53
socket(int _______, int _______, int ________)
creates the socket, domain (AF_UNIX, AF_INET) type (SOCK_STREAM, SOCK_DGRAM, SOCK_RAW) protocol (set to 0)
54
bind(int ______, const struct _________ *_______, socklen_t _________)
bind the socket to an address in the UNIX domain sockfd (returned by socket) sockaddr *serveraddr addrlen
55
listen(int _______, int _________)
instruct the socket to listen for incoming connections sockfd backlog
56
connect(int ______, const struct _________ *_______, socklen_t _________)
kernel will choose a dynamic port and source IP sockfd (returned by socket) sockaddr *serveraddr addrlen
57
send(int ___, const void *____, size_t ____, int _____) | recv(int ___, const void *____, size_t ____, int _____)
s (socket descriptor) buf (buffer of information to send to an empty buffer) len (size of the buffer in bytes flags (0 or MSG_EOR, MSG_OOB)
58
compiler optimization (4)
execution time, code size, memory usage, compile time
59
optimized for code size
optimization flag -Os
60
no optimisation, easy to debug but slower/larger
optimization flag -O0
61
optimize for both speed and size
optimization flag -O1 or -O
62
turn on most optimizations, enables instruction scheduling
optimization flag -O2
63
turn on some extra performance, might increase code size, but increased performance
optimization flag -O3
64
performs usually simple operations on the source files prior to compilation, sends output to stdout
preprocessor
65
translates from one language to another, saves example.s
compiler
66
assembles to relocatable object code, saves object
assembler
67
combines object code and assembling source program, as well as libraries to make executable
linker
68
gets an address to place program, changes necessary addresses, places code into memory
loader
69
modifies binary, inserting probes at function entry/exit to collect data
instrumentation
70
takes statistical samples of application performance
sampling