CSCE3600 - Exam 2 Flashcards Preview

Programming > CSCE3600 - Exam 2 > Flashcards

Flashcards in CSCE3600 - Exam 2 Deck (70):
1

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

thread

2

a program with multiple streams

multithreading

3

threads share...

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

4

ownership of memory, files, and other resources

process

5

makes shell

system()

6

initiate new programs and replaces this process with a new one

exec()

7

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

fork()

8

two reasons for fork to fail

too many processes in the system
total number of processes exceeds system's limit

9

semaphores can be initialized to....

any value

10

semaphores are used for

pthread blocking

11

if semaphore value is less than or equal to zero...

threads are blocked

12

if semaphore value is greater than zero

blocked threads wake up

13

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

race conditions

14

creates a thread

pthread_create

15

set thread to release

pthread_detach

16

test two thread IDs for equality

pthread_equal

17

exit a thread without exiting process

pthread_exit

18

send a signal to a thread

pthread_kill

19

wait for a thread

pthread_join

20

find out own thread ID

pthread_self

21

allow threads to synchronize based upon the actual value of data

condition variables

22

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

waiting on a condition

23

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

signaling on a condition

24

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

file descriptors

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