CSE 222: All Questions

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/93

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

94 Terms

1
New cards

What does xargs do?

xargs is a command that builds and executes command lines from standard input.

2
New cards

How can you get thread information from ps?

You can get thread information from ps by using the 'ps -L' option.

3
New cards

What does lsof do?

lsof lists open files and the processes that opened them.

4
New cards

What is a condition variable?

A condition variable is a synchronization primitive that allows threads to wait until a particular condition is met.

5
New cards

What is a semaphore?

A semaphore is a synchronization tool that controls access to a common resource by multiple threads.

6
New cards

What is a thread?

A thread is the smallest unit of processing that can be scheduled by an operating system.

7
New cards

What are three types of thread management operations?

  1. Creating threads
  2. Synchronizing threads
  3. Terminating threads
8
New cards

What are the benefits of using threads?

Benefits include improved responsiveness, resource sharing, and efficient CPU utilization.

9
New cards

What are some challenges of using threads?

Challenges include deadlocks, race conditions, and debugging complexity.

10
New cards

How do signals interact with threads?

Signals can be sent to specific threads or the entire process, affecting their execution.

11
New cards

What is thread joining?

Thread joining is the operation of waiting for a thread to finish its execution before proceeding.

12
New cards

What are two ways of getting a deadlock error from thread join?

  1. Joining a thread that is waiting for another join.
  2. Circular wait conditions among multiple threads.
13
New cards

What is thread synchronization?

Thread synchronization is the coordination of thread execution to prevent conflicts when accessing shared resources.

14
New cards

What are three ways to manage thread synchronization?

  1. Mutexes
  2. Condition variables
  3. Semaphores
15
New cards

What is a mutex and why would you use it?

A mutex is a mutual exclusion object used to prevent simultaneous access to a resource by multiple threads.

16
New cards

What will read do on an empty pipe?

The read operation will block until data is available or the pipe is closed.

17
New cards

What happens when a pipe is closed?

When a pipe is closed, any read operation on that pipe will return an end-of-file (EOF) immediately.

18
New cards

What is the effect of lseek on a pipe?

lseek does not work on pipes, as they are not seekable.

19
New cards

How does the -v option affect the behavior of grep?

The -v option makes grep invert the match, showing lines that do not match the pattern.

20
New cards

What does mkfifo do?

mkfifo creates a named pipe (FIFO) that can be used for inter-process communication.

21
New cards

What is FIFO?

FIFO (First In, First Out) is a method of organizing and handling data in which the first data added is the first one to be removed.

22
New cards

What is a pipe?

A pipe is a unidirectional data channel used for inter-process communication.

23
New cards

What does ps do?

ps displays information about running processes, including their process IDs and resource usage.

24
New cards

What does wc do?

wc (word count) counts the number of lines, words, and bytes in its input.

25
New cards

What does dup do?

dup duplicates a file descriptor, creating a new file descriptor that refers to the same open file.

26
New cards

What does the head command do?

head outputs the first few lines of a file; by default, it shows the first ten lines.

27
New cards

What does the top command do?

top displays a dynamic view of the system's resource usage, including CPU and memory utilization by processes.

28
New cards

What does the w command do?

w shows who is logged on and what they are doing.

29
New cards

What does crontab do?

crontab is used to schedule commands to be run at specified times and intervals.

30
New cards

What does the tar command do?

tar is used to create, extract, or manipulate archive files.

31
New cards

What is shared memory?

Shared memory is a method of inter-process communication that allows multiple processes to access the same memory segment.

32
New cards

What are the two functions that are used together to access shared memory?

  1. shmget
  2. shmat
33
New cards

What are the two operations on a semaphore?

  1. Wait (P operation)
  2. Signal (V operation)
34
New cards

What does the wall command do?

wall sends a message to all logged-in users.

35
New cards

What is a background process?

A background process runs independently of the user's terminal session, allowing the terminal to be used for other tasks.

36
New cards

How do you start a background process?

You can start a background process by appending '&' at the end of the command.

37
New cards

What does the fg command do?

fg brings a background process to the foreground.

38
New cards

What is a job spec?

A job spec is a way to refer to a background or suspended job in the shell using a job number.

39
New cards

What does the jobs command do?

jobs lists the current active jobs associated with the terminal.

40
New cards

What is a message queue?

A message queue is a form of inter-process communication that allows processes to send and receive messages.

41
New cards

What operations are performed on message queues?

  1. Sending messages
  2. Receiving messages
42
New cards

Where are message queues stored?

Message queues are stored in kernel memory.

43
New cards

What order are messages received in a message queue?

Messages are received in FIFO order.

44
New cards

Where are the default message queue attributes available?

Default message queue attributes are available in the system's kernel.

45
New cards

What is the dominant network model for the internet?

The dominant network model for the internet is the TCP/IP model.

46
New cards

What are the TCP/IP layers?

The layers are:

  1. Application layer
  2. Transport layer
  3. Internet layer
  4. Link layer
47
New cards

What is the application layer?

The application layer is the topmost layer of the TCP/IP model that directly communicates with end-user applications.

48
New cards

What is the transport layer?

The transport layer is responsible for providing communication services directly to the application layer and is responsible for end-to-end communication.

49
New cards

What is TCP?

TCP (Transmission Control Protocol) is a connection-oriented protocol that ensures reliable data transmission.

50
New cards

What is a named semaphore?

A named semaphore is a synchronization primitive that is identified by a name and can be used by multiple processes.

51
New cards

What is an unnamed semaphore?

An unnamed semaphore is a synchronization primitive that is not identified by a name and is typically used within the same process.

52
New cards

What are the numbered directories in /proc?

The numbered directories in /proc represent the process IDs of currently running processes.

53
New cards

What is in /usr?

The /usr directory contains user-related programs, libraries, and documentation.

54
New cards

What does the m4 command do?

m4 is a macro processing language that is often used for generating text files.

55
New cards

What is a passive socket?

A passive socket is used by a server to listen for incoming connections.

56
New cards

What are the steps a server must go through?

  1. Create a socket
  2. Bind the socket to an address
  3. Listen for connections
  4. Accept connections.
57
New cards

What are the steps a client must go through?

  1. Create a socket
  2. Connect to the server's socket.
58
New cards

What does the netstat command do?

netstat displays network connections, routing tables, interface statistics, and a list of open ports.

59
New cards

What does the ss command do?

ss is a utility to investigate sockets, providing detailed information about them.

60
New cards

What are three application layer protocols?

  1. HTTP
  2. FTP
  3. SMTP
61
New cards

What is UDP?

UDP (User Datagram Protocol) is a connectionless protocol that allows data transmission without establishing a connection.

62
New cards

What is IP?

IP (Internet Protocol) is a protocol that routes packets of data from the source to the destination across networks.

63
New cards

What is the link layer?

The link layer is responsible for node-to-node data transfer and is concerned with the physical addressing and access to the medium.

64
New cards

What is a MAC address?

A MAC address is a unique identifier assigned to network interfaces for communication on a physical network.

65
New cards

What is a socket?

A socket is an endpoint for sending or receiving data across a computer network.

66
New cards

What is a port number?

A port number is a numerical identifier in networking used to distinguish different services on a server.

67
New cards

What is a stream socket?

A stream socket is a type of socket that provides a reliable, two-way communication channel.

68
New cards

What is a datagram socket?

A datagram socket is used for sending and receiving messages without establishing a connection.

69
New cards

What functions are used to write to a socket?

The functions used to write to a socket include send() and write().

70
New cards

What is a directory?

A directory is a special file in a filesystem that contains references to other files or directories.

71
New cards

What information is stored in /etc/passwd?

The /etc/passwd file contains user account information, including user names, user IDs, and home directories.

72
New cards

What are the permission bits of a file?

The permission bits of a file determine the access rights for the owner, group, and others.

73
New cards

What is a child process?

A child process is a process created by another process (the parent) through a system call.

74
New cards

What is a kernel?

The kernel is the core component of an operating system that manages system resources and communication between hardware and software.

75
New cards

Name three types of files in Unix.

  1. Regular files
  2. Directories
  3. Special files (such as device files).
76
New cards

What is a shell?

A shell is a command-line interface that allows users to interact with the operating system.

77
New cards

What is an i-node?

An i-node is a data structure on a filesystem that stores information about a file or a directory, except its name.

78
New cards

What is a process?

A process is an instance of a program that is being executed.

79
New cards

What is a umask?

A umask is a mask that determines the default permission bits for newly created files.

80
New cards

What are some ways an open call can fail?

  1. Specified file does not exist
  2. Insufficient permissions
  3. Maximum file descriptor limit reached.
81
New cards

What does read return when at the end of a file?

read returns 0 when it reaches the end of a file.

82
New cards

What is a hole?

A hole in a file is a sequence of unallocated bytes in a sparse file.

83
New cards

What are the three ways lseek can use to adjust the file offset?

  1. SEEK_SET: Set offset to specified value.
  2. SEEK_CUR: Set offset to current value plus offset.
  3. SEEK_END: Set offset to end of file plus offset.
84
New cards

What are the benefits of providing system calls in Unix?

Benefits include abstraction of hardware, safe and consistent access to resources, and control of system behavior.

85
New cards

How do most system calls behave during a failure?

Most system calls return -1 on failure and set the errno variable to indicate the error.

86
New cards

What are some appropriate error handling mechanisms?

  1. Check return values of system calls.
  2. Use errno for error information.
  3. Implement retries or fallback mechanisms.
87
New cards

What is the difference between a file descriptor and an open file description?

A file descriptor is an integer handle; an open file description includes the file position and access mode information.

88
New cards

What are the mandatory flags for opening a file?

The mandatory flags include ORDONLY, OWRONLY, and O_RDWR.

89
New cards

What is synchronous IO?

Synchronous IO is a type of input/output operation where the calling process waits for the operation to complete before continuing.

90
New cards

What is synchronized IO?

Synchronized IO refers to managing access to shared resources to prevent data corruption.

91
New cards

What information does ls with the long option provide?

ls -l provides details such as file permissions, number of links, owner, group, file size, and time of last modification.

92
New cards

What can be found in the /var/log directory?

/var/log contains log files for various system services and applications.

93
New cards

What type of entries can be found in section 5 of the man pages?

Section 5 contains documentation for file formats and conventions.

94
New cards

What Unix command is used to modify file permissions?

The chmod command is used to modify file permissions.