CS609 Final Term Current Subjective Solved 2023
- Type
- Final term past paper
- Course
- CS609 System Programming
- Size
- PDF 494 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 6. Download the file for all 6 pages.
Q1. What is Explicit Linking and which Windows API is used to load a DLL explicitly inside a program?
Answer: Answer: Explicit linking is a method of loading dynamic-link libraries (DLLs) in Windows programs. When a program uses explicit linking, it loads the DLL manually at runtime and explicitly calls the functions within the DLL that it needs. The Windows API used to load a DLL explicitly inside a program is called " LoadLibrary". The LoadLibrary function loads the specified DLL into the address space of the calling process and returns a handle to the loaded module. Once a module is loaded, the program can use the GetProcAddress function to obtain the address of a function within the DLL, which can then be called like any other function. Explicit linking is useful when a program only needs to use certain functions within a DLL and doesn't want to incur the overhead of loading the entire DLL into memory.
Q2. Name the two Windows APIs that are used to return the pseudo and real handle of a process.
Answer: The two Windows APIs used to return the pseudo and real handle of a process are:
- GetCurrentProcess(): This function returns a pseudo handle to the current process. A pseudo handle is a special constant that represents the current process and does not need to be closed.
- OpenProcess(): This function opens a real handle to a specified process. It takes two parameters: the first parameter is the desired access to the process (such as read, write, or execute), and the second parameter is a Boolean value indicating whether the handle should be inheritable by child processes. The function returns a real handle to the specified process if successful, or NULL if an error occurred.
Q3. Briefly describe the two parameters associated with the following Windows API. FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName).
Answer: Answer: The Windows API " GetProcAddress" is used to retrieve the address of an exported function or variable from a specified dynamic-link library (DLL). It takes two parameters: HMODULE hModule: This parameter is a handle to the loaded module (DLL) that contains the function or variable to be retrieved. If this parameter is NULL, the function retrieves the address of the function or variable from the current process's executable file. LPCSTR lpProcName: This parameter is a pointer to a null-terminated string that specifies the name of the function or variable to be retrieved. If this parameter is an ordinal value, rather than a string, it represents the numeric value that corresponds to the function's position in the DLL's export table.
Q4. Briefly explain system mask and process mask.
Answer: System mask and process mask refer to sets of processor affinity masks that determine which processors a system or a process is allowed to use. System mask: The system mask is a bit mask that specifies which processors are available for use by the entire system. By default, all processors are included in the system mask. However, system administrators can modify the system mask to exclude certain processors from use. Process mask: The process mask is a bit mask that specifies which processors a specific process is allowed to use. By default, a process is allowed to run on any processor in the system. However, the process mask can be set using the SetProcessAffinityMask function to restrict a process to a subset of the available processors. Restricting the processor affinity of a process can have performance implications. On one hand, restricting a process to a subset of available processors can reduce contention for shared system resources such as memory and I/O. On the other hand, it can also result in decreased performance if the process is CPU-bound and the restricted set of processors is insufficient to handle its workload.
Q5. Briefly describe each parameter in the following Widows API.
BOOL GetProcessTime(HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime,
LPFILETIME lpUserTime );
Answer: Answer: The Windows API " GetProcessTimes" is used to retrieve timing information about a specified process. It takes five parameters: HANDLE hProcess: This parameter is a handle to the process for which timing information is being retrieved. This handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. LPFILETIME lpCreationTime: This parameter is a pointer to a FILETIME structure that receives the creation time of the process. LPFILETIME lpExitTime: This parameter is a pointer to a FILETIME structure that receives the exit time of the process. If the process has not exited, this parameter receives a NULL value. LPFILETIME lpKernelTime: This parameter is a pointer to a FILETIME structure that receives the amount of time that the process has spent executing in kernel mode. LPFILETIME lpUserTime: This parameter is a pointer to a FILETIME structure that receives the amount of time that the process has spent executing in user mode.
Q6. What is the purpose of dwPipeMode parameter in CreateNamedPipe() API and mention the names of its two commonly used values.
Answer: Answer: The dwPipeMode parameter in the CreateNamedPipe() API function specifies the mode of the named pipe being created. It determines how data can be transferred through the pipe and how the pipe behaves in different situations. The dwPipeMode parameter can be set to one or more of the following flags: PIPE_WAIT: This flag specifies that the pipe is in blocking mode, which means that ReadFile and WriteFile operations will block until data is available or can be written. PIPE_NOWAIT: This flag specifies that the pipe is in non-blocking mode, which means that ReadFile and WriteFile operations will return immediately, even if there is no data available or the pipe is full. PIPE_READMODE_BYTE: This flag specifies that the pipe operates in byte mode, which means that data is read and written in byte-sized blocks. PIPE_READMODE_MESSAGE: This flag specifies that the pipe operates in message mode, which means that data is read and written in message-sized blocks. PIPE_TYPE_BYTE: This flag specifies that the pipe is a byte-type pipe, which means that the data is transferred as a stream of bytes. PIPE_TYPE_MESSAGE: This flag specifies that the pipe is a message-type pipe, which means that the data is transferred as a series of messages.
Q7. Which Windows API is used to release the ownership of a mutex? Also write its signature.
Answer: Answer: The Windows API used to release the ownership of a mutex is called ReleaseMutex(). The signature of the ReleaseMutex() API is as follows: BOOL ReleaseMutex( HANDLE hMutex
HANDLE hMutex: This parameter is a handle to the mutex object. The calling thread must be the owner of the mutex. If the calling thread is not the owner of the mutex, the function will fail and return zero.
Q8. Write the four function names of semaphores?
- CreateSemaphore()
- CreateSemaphoreEx()
- OpenSemaphore()
- ReleaseSemaphore()
Q9. Write the types of Semaphores?
Answer: There are four types of Semaphores:
- Creating a semaphore
- Deleting a semaphore
- Waiting a semaphore
- Releasing a semaphore
Q10. This Answer is important for mcqs and short question?
GetCurrentThreadId()
Obtains thread Id rather than the handle.
GetThreadId()
Obtains thread Id from thread handle.
GetCurrentThread()
Non-inheritable pseudohandle to the calling thread.
Related CS609 files
All CS609 files →- CS609 Final Term Quizzes 13 July 2023 by Sana Sheikh Quiz PDF 570 KB
- CS609 Final Term Quiz 2023 by Imran Quiz PDF 21.1 MB
- CS609 Final Term Current Paper Solved Fall 2022 by Rajpoot Final term PDF 601 KB
- CS609 Final Term Current Paper 2020 Final term PDF 475 KB
- CS609 Highlighted Handouts Set 2 by VU Topper RM Highlighted PDF 3.2 MB
- CS609 Quiz 1 Set 2 Quiz PDF 857 KB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.