Skip to content
VUBuddy

CS609 Final Term Solved Subjective Set 2 by Junaid

System Programming PDF 859 KBUpdated 23 Oct 2026
Final term past paper CS609 Final Term Solved Subjective Set 2 by Junaid PDF 859 KB
vubuddy.com
Type
Final term past paper
Course
CS609 System Programming
Size
PDF 859 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 859 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 2, 3, 4 of 18. Download the file for all 18 pages.

  1. How a DLL file is loaded inside a program during explicit linking? Mention the API that is used for this purpose.

NOTE: HERE is THREE TYPE ANSWER WHICH ONE PREFER AS YOU LIKE

  •  Call the LoadLibrary function with the name of the DLL file as its parameter to load the DLL into memory and obtain a handle to it.
  •  Use the GetProcAddress function to obtain the addresses of the functions and data within the DLL file.
  •  Call the functions or access the data within the DLL using the obtained function or data pointers.

OR

  •  Directory containing the application
  •  The system directory. This path can be determined by GetSystemDirectory()
  •  The windows directory (GetWindowsDirectory())
  •  The current directory
  •  Directories specified by the PATH environment variable

OR

Explicit linking requires the program to explicitly a specific DLL to be loaded or freed. Once the DLL is loaded then the program obtains the address of the specific entry point and uses that address as a pointer in function call. The function is not declared in the calling program. Rather a pointer to a function is declared. The functions required are:

HMODULE LoadLibrary( LPCTSTR lpLibFileName );

  1. Write the names of functions that are used to determine the amount of time consumed by:

1. Process

2. Thread

Answer:  To determine the amount of time consumed by a process, the time function or the clock function can be used in C/C++ programming language.  To determine the amount of time consumed by a thread, the clock_gettime or gettimeofday function can be used in C/C++ programming language. In other programming languages, such as Java, the System.nanoTime function can be used to measure the time consumed by a thread.

Q3. When a thread enters into the critical section and is not willing to leave the critical section, then what will its consequences?

Answer: If a thread enters the critical section and refuses to leave, it can cause other threads to wait indefinitely, leading to a deadlock. This can result in a system hang or a crash.

  1. Write the first two steps required for mapping a file to a region in virtual address space of a calling process.
  •  The first step to map a file to a region in virtual address space of a calling process is to open the file using the open system call.
  •  The second step is to use the mmap system call to map the file to a region in virtual address space.
  1. What is the purpose of InitializeCriticalSection And Spin CountO API? Also mention the names of its parameter.

Answer: The InitializeCriticalSectionAndSpinCount API is used to initialize a critical section object in Windows with a spin count, which allows for better performance by using spinning instead of waiting. Its parameters are the critical section object to initialize and the spin count.

The names of its parameter:

LPCRITICAL_SECTION lpCriticalSection

Q6. What is Explicit Linking and which Windows API is used to load a DLL explicit inside a program?

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".

  1. Name any Two Windows API That are used to return the Pseudo and real handle of a process.
  •  GetCurrentProress() GetCurrentProcess() is used to create a psuedohandle. It’s not inheritable and desired access attributes are undefined.
  •  GetCurrentProcessId() The OpenProcess() function is used to obtain the process handle using the process ID obtained by GetCurrentProcessId() or otherwise.
  1. Briefly Describe the two parameters associated with the following windows API. FARPROC GetProcessAddress(HMODULE hModule, LPCSTR lpProcName).

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:

 LPCSTR lpProcName

9. In what situation the termination handler is ignore by a process

The process has installed a signal handler that overrides the default termination handler for the SIGTERM signal. The process is unable to execute the termination handler due to resource constraints, such as a lack of available memory or CPU time.

Q10. Which window function is used to convert thread into fiber?

Answer: Converting a thread into a fiber is a programming concept that involves creating a lightweight thread that can be cooperatively scheduled within a single operating system thread. the concept of converting a thread into a fiber is not directly related to window functions, and there is no specific window function that is used for this purpose.

11. Write the signature of InterlockedExchange() API with its return type and parameters

Answer: LONG InterlockedExchange( LONG volatile *Target,

All CS609 files →
CS609 System Programming All CS609 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.