Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 8 páginas
Examen

CSCI 3120 Midterm Exam Questions With Already Passed Solutions (Graded A+)

Document preview thumbnail
Vista previa 2 fuera de 8 páginas

What is a thread library? - Answer An API that programmers can use to create and manage threads How can a thread library be implemented? - Answer User Level - Entirely implemented in user space. No system calls are made. Kernel Level - Implemented with kernel support, ie. handled by OS. Typically results in a system call What are the main thread libraries used today? - Answer POSIX Pthreads Windows thread library Java thread API What is POSIX? - Answer A family of standards. Used to ensure compatibility between operating systems. Defines API behavior, and the shell U/I requirements. Are POSIX pthreads user level or kernel level? - Answer Can be both. In Linux they are kernel level. Is the Windows thread library user level or kernel level? - Answer Kernel level Is the Java thread API user level or kernel level? - Answer User level in that the thread is created on the machine itself, but in doing this the Windows thread library or POSIX pthreads are typically invoked depending on the host OS. What is asynchronous threading? - Answer Once parent creates child thread, parent continues to run without any knowledge of what the child thread is doing. Very little data sharing between threads.

Vista previa del contenido

CSCI 3120 Midterm Exam Questions
With Already Passed Solutions (Graded
A+)
What is a thread library? - Answer An API that programmers can use to create and manage
threads



How can a thread library be implemented? - Answer User Level - Entirely implemented in user
space. No system calls are made.



Kernel Level - Implemented with kernel support, ie. handled by OS. Typically results in a system
call



What are the main thread libraries used today? - Answer POSIX Pthreads



Windows thread library



Java thread API



What is POSIX? - Answer A family of standards. Used to ensure compatibility between
operating systems.



Defines API behavior, and the shell U/I requirements.



Are POSIX pthreads user level or kernel level? - Answer Can be both. In Linux they are kernel
level.



Is the Windows thread library user level or kernel level? - Answer Kernel level



Is the Java thread API user level or kernel level? - Answer User level in that the thread is
created on the machine itself, but in doing this the Windows thread library or POSIX pthreads
are typically invoked depending on the host OS.

, Typically used for responsive user interfaces.



What is synchronous threading? - Answer The parent thread is not allowed to continue
execution until the children have finished working.



Typically involves significant data sharing between threads.



Where does the first thread begin in a program? - Answer In the main() function



How do threads share data? - Answer Using global variables



What datatype is used to reference a child process? - Answer pid_t, implemented as an int



What datatype is used to reference a child thread? - Answer pthread_t



When we create a thread in C in practice what do we need to do? - Answer Create a pthread_t
object to reference the thread (id)



Create a pthread_attr_t object to reference the attributes of the thread (attr)



------



Call pthread_attr_init(attr) to initialize your attributes



Call pthread_create(id, attr, function, param) which creates the new thread and specifies which
function will be called in the thread, passes in any parameters



Call pthread_join(id) after the create function IF you want the parent to wait for the child to
finish



Call pthread_exit in the child function when you want to end the thread.

Información del documento

Subido en
13 de mayo de 2025
Número de páginas
8
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$12.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
COCOSOLUTIONS
4.2
(37)
Vendido
220
Seguidores
16
Artículos
9308
Última venta
6 días hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes