0% found this document useful (0 votes)
6 views

Systems Programming Assignment

The document discusses the evolution from 16-bit to 32-bit systems, highlighting the advantages of the 32-bit flat memory model, which allows for easier memory management and improved performance. It outlines the architecture of the Windows operating system, detailing user and kernel modes along with key components such as the Win32 API and NT Kernel. Additionally, it provides practical examples for writing a simple Windows program, analyzing system processes with Process Explorer, and implementing memory management operations using WinAPI functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Systems Programming Assignment

The document discusses the evolution from 16-bit to 32-bit systems, highlighting the advantages of the 32-bit flat memory model, which allows for easier memory management and improved performance. It outlines the architecture of the Windows operating system, detailing user and kernel modes along with key components such as the Win32 API and NT Kernel. Additionally, it provides practical examples for writing a simple Windows program, analyzing system processes with Process Explorer, and implementing memory management operations using WinAPI functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Windows System Programming for Intel386 Architecture

1. Evolution of 16-bit vs. 32-bit Systems


16-bit Systems:
 Early PCs (e.g., Intel 8086/8088) used 16-bit architecture.
 Limited to 1 MB of addressable memory due to 20-bit address bus.
 Segmented memory model: Memory divided into 64 KB segments.
 Examples: MS-DOS, Windows 3.x.
32-bit Systems:
 Introduced with Intel 80386 processor.
 Supports up to 4 GB of addressable memory (2^32 bytes).
 Flat memory model simplifies memory addressing.
 Enhanced performance, multitasking, and security features.
 Examples: Windows NT, Windows 95/98/XP.

2. Overview of the 32-bit Flat Memory Model


Flat Memory Model:
 Memory is a single, continuous address space.
 No segmentation; linear addressing simplifies programming.
 Each process has its own 4 GB virtual address space (2 GB for user mode, 2 GB for
kernel mode in Windows).
Advantages:
 Easier memory management.
 Improved performance due to direct addressing.
 Better support for multitasking and virtual memory.

3. Windows OS Architecture and Its Components


Windows Architecture:
I.User Mode:
 Applications and subsystems (e.g., Win32, POSIX).
 Limited direct access to hardware.
II. Kernel Mode:
 Core OS components: Executive, Kernel, Hardware Abstraction Layer (HAL), Device
Drivers.
 Manages system resources, security, and hardware interaction.

Key Components:
 Win32 API: Interface for application development.
 NT Kernel: Core of the OS, handles process scheduling, memory management, etc.
 HAL: Abstracts hardware differences for portability.
 Executive Services: I/O management, object manager, security monitor, etc.

Practical
1. Writing and Compiling a Simple Windows Program (WinAPI)
Objective: Write a "Hello, World!" program using the WinAPI.
Steps:
1. Install a C/C++ compiler (e.g., Microsoft Visual Studio or MinGW).
2. Sample code:
```c
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR


lpCmdLine, int nCmdShow) {
MessageBox(NULL, "Hello, World!", "My First WinAPI Program", MB_OK);
return 0;
}
```
3. Compile the program using the command line or an IDE.
 For Visual Studio: Build the project.
 For MinGW: `gcc -o hello.exe hello.c -mwindows`
4. Run the executable (`hello.exe`).

2. Using Process Explorer to Analyze Windows System Processes


Objective: Analyze running processes and system resources.
Steps:
1. Download and run [Process Explorer]
2. Explore the interface:
 View process hierarchy.
 Check CPU, memory, and I/O usage.
 Identify processes and their associated DLLs.
3. Analyze a specific process (e.g., `explorer.exe`):
 Right-click → Properties.
 Examine threads, handles, and performance metrics.

Figure 1:Process explorer

3. Implementing a Simple Memory Management Operation in Windows


Objective: Allocate and free memory using WinAPI functions.
Steps:
1. Sample code:
```c
#include <windows.h>
#include <stdio.h>

int main() {
// Allocate memory
LPVOID pMemory = VirtualAlloc(NULL, 4096, MEM_COMMIT,
PAGE_READWRITE);
if (pMemory == NULL) {
printf("Memory allocation failed!\n");
return 1;
}

// Use the memory


sprintf((char*)pMemory, "Hello, Memory!");
printf("Allocated memory content: %s\n", (char*)pMemory);

// Free the memory


VirtualFree(pMemory, 0, MEM_RELEASE);
printf("Memory freed.\n");

return 0;
}
```
2. Compile and run the program.
3. Verify the output:
```
Allocated memory content: Hello, Memory!
Memory freed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy