Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

GFACT CERTIFICATION EXAM WITH ACTUAL QUESTIONS AND ANSWERS 100%, Exams of Computer Networks

GFACT CERTIFICATION EXAM WITH ACTUAL QUESTIONS AND ANSWERS 100% GFACT certification exam GFACT exam questions GFACT certification questions GFACT practice exam GFACT exam answers GFACT test preparation actual GFACT exam questions real GFACT exam answers GFACT study guide GFACT exam materials GFACT certification training pass GFACT exam GFACT test questions GFACT exam dumps GFACT practice questions GFACT exam guide GFACT certification study GFACT sample questions GFACT mock exam GFACT preparation course GFACT exam online GFACT certification resources GFACT questions and answers GFACT exam topics GFACT exam review GFACT online test GFACT certification practice GFACT exam tips GFACT test prep

Typology: Exams

2024/2025

Available from 05/03/2025

berine-odessy
berine-odessy 🇺🇸

41 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download GFACT CERTIFICATION EXAM WITH ACTUAL QUESTIONS AND ANSWERS 100% and more Exams Computer Networks in PDF only on Docsity!

1. What is multithreading? Ans In computer architecture, multithreading is the ability of a central processing unit (CPU) (or a single core in a multi-core processor) to execute multiple processes or threads concurrently, supported by the operating system. 2. what is a thread? Ans A thread is the smallest unit of processing that can be performed in an OS. In most modern operating systems, a thread exists within a process - that is, a single process may contain multiple threads 3. Why are a number of threads used in executing any application program?- Ans Because if any single thread is blocked, the application will not stop. Most of the programming languages use the concept of multi-threading. 4. Provide two programming examples in which multithreading does not pro- vide better performance than a single-threaded solution Ans In a web server envi- ronment, a number of users request for the application. Thus, when any application is executed through the web server, a number of different threads are executed for different users. In GUI, different threads are executed for different tasks. For example, first thread is used 1/19 to fix the bugs, the second thread is responsible for the execution of the program, and another one is responsible for the performance of the program. 5. What are two differences between user-level threads and kernel-level threads? As User-level threads MiSs The existence of user-level threads is unknown to the kernel. Kernel-level threads Wiis The existence of kernel-level threads is known to the kernel. User level threads Ans are managed without kernel support. Kernel level threads AWS are managed by the OS. User level threads AWS are faster to create than kernel level threads. Kernel level threads WRB are slower to create. User level threads AWS are scheduled by the thread library Kernel level threads AWS are scheduled by the kernel. 6. Under what circumstances is one type of thread better than the other? (kernel better than user) Ans If the kernel is single-threaded, then kernel-level threads are better than user-level threads, because any user-level thread performing a includes a memory map, list of open files, and environment variables. Allocating an managing the memory map is typically the most time consuming activity. 11. describe the actions taken by a kernel to context-switch between ker- nel-level threads. What happens to the context stored in the registers of the CPU? iis When a context switch is occurring among the threads of kernel level, the kernel suspends all the threads and their respective values from the registers of the CPU. The newly scheduled threads restore the values in the registers. Thus, due to this, the current process state is also saved as well as the state of the incoming processes can also be restored. For a kernel, the execution time is the main issue. If the new processes are created for the execution, rather than threads, it becomes more time consuming. So, the context stored in the registers of the CPU is switched. 12. Assume that an operating system maps user-level threads to the kernel using the many-to-many model and that the mapping is done through LWP's. Furthermore, the system allows developers to create real-time threads for use in real-time system.s Is it necessary to bind a real-time thread to an LWP? Explain. Ans In an application which is based on real time processing, time plays an important role for execution. Threads are the parts of the process and also known as light weight processes (LWP) When athread is noticeable as a thread of real time but a lightweight process is not bounded with this thread, then, the thread must have to be waiting for the attachment of LWP. When an LWP is attached to any thread, the priority of that thread becomes higher. So, ina condition of dead lock, if a thread is having LWP, the thread has a minimum waiting time for the execution and time is saved. Thus, it can be said that the LWP attached thread is required in the real time systems. 13. Provide two programming examples in which multithreading does provide better performance than a single-threaded solution Ans In linear programming, the multithreading does not provide better performance than a single-threaded solution. In the single-threaded solution, the linear programming has better performance. Programs like, computer the factorial of anumber, sorting numbers, and minimizing the linear equations provide better performance using the single thread. The multithreading does not provide better performance in the shell programs. The shell programs use the single thread to execute the program. C shell and korn shell programs do not provide better in multithreading. 14. Under what circumstances does a multithreaded solution using multiple kernel threads provide better performance than a single-threaded solution on a single- processor system? 15. Two programming examples for the better performance is as follows? Wis Se- quential programs are not good for candidates for multi programming. Calculating individual tax returns is one of the examples for this type of program. The second example can be any shell programs like C-shell or Korn shell. These programs monitor its own working places such as open files, current working directory, and environment 16. Is the user schedules the process in the kernel threads, if one kernel thread is blocked? it_- Ans it automatically switches to the other. 17. It is efficient for the system to schedule user level processes to Wiis the kernel threads 18. For scheduling purposes, some OS assigns the user-level threads to the Ais Kernel threads 19. Itis much more complicated for the single-threaded solution to achieve the efficiency achieved by the Ans Multi threaded solution 20. Which of the following components of program state are shared across threads in a multithreading process? A. Register values B. Heap memory C. Global variable D. Stack memory Ans B. Heap memory and global variables shared across in mul- 7/19 ti-thread process. In multi-thread process, each thread has its own stack and register values. 21. Can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on a single-processor system? Ans in multithreading, there are multiple user-level threads running simulta- neously doing different tasks. The operating system assigns the multiple user level threads to different kernel level processes for the purposes of scheduling the tasks. 22. Which is more efficient- single processor systems multiprocessor sys- tems? Ans Multiprocessor systems 23. Describe the dependency of threads and processes. Ans processes act inde- pendently while threads always remain dependent on their consequent thread for their execution. Threads remain a chain of instructions where a small breakdown may terminate the entire execution. 24. Is it possible to have concurrency but not parallelism? Explain. Wiis Concurren- cy but not parallelism Both are a form of an operating system. Sometimes, to complete a task, both methods needed to finish the task and sometimes one. The priority to select, which p1-4, so both process go for simultaneous execution and each works independently. 31. So in all, is it possible to have concurrency but not parallelism? Wiis Yes 32. What is task parallelism? Ais The task or thread is allocate across the multiple computing cores and each core operates same operation of those data. 33. What is data parallelism? iis The subset of same data is allocated across the multiple computing cores and each core operates same operation on those data. 34. A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application is running on this system. All input is performed at program start-up, when a single file must be opened. Similarly, all output is performed just before the program terminates, when the program results must be written to a single file. between startup and termination, the program is entirely CPU-bound. Your task is to improve the performance of this application by multithreading it. The application runs on a system that uses the one-to-one threading model (each user thread maps to a kernel thread). How many threads will you create to perform the input and output? Explain.- iis Thread count depends upon the priority and requirements of the application. So only thread is enough for this kind of application and this thread is going to handle both input and output operation. It only makes sense here to create as many threads as there are blocking-system calls, as the threads will be spent blocking. There are no benefits in creating additional threads. 35. A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application is running on this system. All input is performed at program start-up, when a single file must be opened. Similarly, all output is performed just before the program terminates, when the program results must be written to a single file. between startup and termination, the program is entirely CPU-bound.Your task is to improve the performance of this application by multithreading it. The application runs ona system that uses the one-to-one threading model (each user thread maps to a kernel thread). How many threads will you create for the CPU-intensive portion of the ap- plication? Ans Four threads are created to perform the CPU intensive portion of the application. It is because, there should be as many threads as there are processing cores. >4, wouldn't run. <4, waste of processing resources to use fewer than 4 36. Consider the following code segment 11/19 The statement fork(); in the if statement creates one process. The parent process p1 creates this process. let it be p2 After the if statement, parent process pO, process p1, and process p2 will execute fork(); creating three new processes. One process is created by parent process pO. One is created by p1, and one by p2. Let the three new processes created by pO, p1, and p2 are p4, p5, and p6. Therefore, 6 unique processes created. 37. pid_t pif; pid = fork(); if (pid==0) { /* child process */} fork(); thread_create(...); } fork(); How many unique threads are created? is Thread creation is done in if block by the function pthread_create(). Only child process p1 is executed in the if block. Therefore, process p1 will create one thread. In the if block one process p2 is created using the fork(). Therefore, process p2 will also 13/19 create a thread. Hence, the number of unique threads created are 2. 38. Can Linux understand both threads and processes? Ans No, it considers both threads and processes as tasks. It cannot distinguish between them. 39. Can windows understand both threads and processes? is Windows OS un- derstands threads and processes as different. 40. what are the pros of the way Linux views threads and processes? Ans Linux consider these as similar, so codes belong to OS can be cut down easily. Scheduler present in the Linux OS do not need special code to test threads coupled 14/19 Output at Line P The output is PARENT iis value = 0. After completing the child process, the value of the global variable present in the parent process remains 0. Thus, it will remain zero and print 0. 43. Consider a multicore system and a multithreaded program written using the many- to-many threading model. Let the number of user-level threads in the program be greater than the number of processing cores in the system. Discuss the performance implications of the following scenarios The number of kernel threads allocated to the program is less than the number of processing cores. Wis The scheduler in the system can schedule only one kernel 16/19 thread at a time to one user level process. Since the system is many to many threading model, many user level processes and kernel threads will be idle. The number of processors is greater than the kernel threads, processes can be mapped to kernel threads which is available and can be accessed quickly. most of the processors will not be utilized and they will be idle. 44. Consider a multicore system and a multithreaded program written using the many- to-many threading model. Let the number of user-level threads in the program be greater than the number of processing cores in the system. Discuss the performance implications of the following scenarios The number of kernel threads allocated to the program is equal to the number of processing cores. iis The scheduler in the system can schedule only one kernel thread at a time to one user level process. Since the system is many to many threading model, many user level processes and kernel threads will be idle. The number of processors is equal to the kernel threads; hence, all the user level processors run concurrently in the kernel threads assuming all kernel threads are free and none of them are blocked. 45. Consider a multicore system and a multithreaded program written using the many- to-many threading model. Let the number of user-level threads in the program be greater than the number of processing cores in the system. Discuss the performance implications of the following scenarios 49. What are the two states in thread cancellation? Wiig PTHREAD_CANCEL_DIS- ABLE PTHREAD_CANCEL_ENABLE 50. What is the default thread cancellation type? Wiig PTHREAD_CANCEL_DIS- ABLE 51. What two points are known as cancellation points? What function is used to create them? iis The system test for pending cancellation requests in certain blocking functions, if cancellation function is ENABLED and its type is DEFERRED. These points are known as cancellation points. pthread_testcancel() function is used to create cancellation points.