exam2again

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A socket system call returns _______for the created socket A) A file descriptor B) A process ID C) A thread ID D) A memory address1

A file descriptor

A fork() function returns _______ for the newly created process. A) A file descriptor B) A process ID C) A thread ID D) 0

A process ID

A pthread_create function returns_______ for the newly created thread. A) A file descriptor B) A process ID C) A thread ID D) A memory address

A thread ID

Port numbers Select all that apply A) can be set by bind() in the POSIX socket APIs B) are assigned only to the end of a connection which calls accept() C) are typically used by routers to decide where to send messages

A) can be set by bind() in the POSIX socket API's

A process control block should contain ________ . (A) the process state (B) a list of open files (C) the contents of CPU registers (D) all of the above

All of the above the process state a list of open files the contents of the CPU registers

Context switching between processes is carried out by the________. (A) job (long-term) scheduler (B) CPU (short-term) scheduler (C) interrupt handler (D) thread manager

cpu short-term scheduler

A ________ situation occurs when multiple threads are waiting on one another to release CPU resources so they can run. For example, this can happen when a single thread has exclusive priority but needs resources from a waiting thread, or all the threads are depending on one another to release needed resources.

deadlock

true or false if there are no connection requests and the socket is non-blocking, accept() function blocks till a connection request comes in

false

Which of the following pieces of information is shared among allthreads in a single process? (A) Heap (B) Stack (C) Program Counter (PC) (D) None of the above.

heap

heap is for

instance/class variables

exit()

it doesn't return, it terminates the calling process with an exit status

Stack is for

local/method variables

exec()

on success it doesn't return on failure it returns -1

wait()

returns the PID of the terminated child process or -1 on failure

getppid()

returns the parent process ID of the calling process

getpid()

returns the pid of the calling process

getpgrp()

returns the process group ID of the calling process as an integer value

Threads share ____________________________, but they don't share the stack

the code and data segments and the heap

In a client-server networking application,which process typically creates a new child process to handle each incoming client connection? A) The client process B) The server process C) Both the client and server processes D) Neither the client nor server process

the server process

What is the primary purpose of the exec family of system calls (execl, execv, execve) in Unix-based operating systems? A) To create a new process B) To terminate a process C) To replace the current process with a new process D) To synchronize access to shared resources between multiple processes

to replace the current process with a new process

True or False A race condition occurs when multiple concurrent threads compete to run first. If the thread that wins the race isn't the one that was supposed to run first, the code may exhibit unexpected behavior. You can resolve this problem with synchronization.

true

Which of the following statements is true regarding processes and their requirements? A) A process is the same as an executing program. B) A process doesn't require any resources to accomplish its task. C) A process requires only CPU time to accomplish its task. D) A process needs certain resources, including CPU time,memory, files, and I/O devices, to accomplish its task.

A process needs certain resources, including CPU time,memory, files, and I/O devices, to accomplish its task.

In a multitasking operating system, what is the main cost associated with context switching between processes? A) CPU time spent performing the context switch B) Memory overhead associated with saving and restoring process state C) Delay incurred in suspending and resuming processes D) Disk I/O operations required to swap process data to and from memory

CPU time spent performing the context switch

Which of the following statements is true about long-term scheduler? A) It is responsible for context switchingbetween processes. B) It is responsible for selecting processes from memory for execution. C) It determines which programs are selected for execution from a queue of new processes. D) It is responsible for allocating memory to processes.

It determines which programs are selected for execution from a queue of new processes.

In a multithreaded application, why is thread synchronization needed? A) To improve thread performance B) To prevent threads from accessing shared resources simultaneously C) To reduce the number of threads in theapplication D) To prevent threads from crashing the application

To prevent threads from accessing shared resources simultaneously

A _________ is where the current state ofa thread or process is stored so theexecution of that thread can resume at alater time. This enables a single CPU tomanage multiple threads or processes.

context switch

Which system call associates an address with a socket? A) bind() B) connect() C) listen() D) accept()

bind()

On a typical implementation of POSIX, using read() to read one byte from a file descriptor with a call like: read(fd, buffer, 1); where the file descriptor is opened to a file on a hard disk will: A) cause the OS to request exactly one byte from the disk, then store that byte in the application's buffer B) cause read to return an error because the hard disk can only read data in larger blocks C) cause the OS to request a block of data (larger than one byte) from disk and store it in the OS's memory, then copy one byte of that into the application's buffer D) cause the OS to request a block of data (larger than one byte) from disk,then copy the entire block into the application's buffer

cause the OS to request a block of data (larger than one byte) from the disk and store it in the OS's memory, then copy byte of that into the application's buffer


Ensembles d'études connexes

Immunity, Infection, & Inflammation PP1 EAQs

View Set

Intermediate 2 Computing Exam S3

View Set

NICE DUDE BASSETT SEMESTER 2 EXAM QUOTES? YOU MUST BE SMART AS HELL DUDE!

View Set

Ch 36 PrepU: Mgmt of Patients with Immune Deficiency Disorders

View Set

Cross-Cultural Psychology Midterm

View Set

Business, Ethics, and the Creation of Value #2

View Set

Chapter 32 Environmental Emergencies

View Set

Unit 10: Sales Contracts and Practices

View Set