Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Lecture-1-Introduction-to-Windows-System-Programming

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lecture-1-Introduction-to-Windows-System-Programming

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Lecture 1: Introduction to

Windows System
Programming
Windows
Windows is an operating system developed by Microsoft. It
provides a graphical user interface (GUI) for interacting with your
computer.
key Features:

Start Menu & Taskbar – Quick access to apps, files, and settings.
File Explorer – Manages files and folders efficiently.
Settings & Control Panel – System configurations and tweaks.
Windows Defender – Built-in security system for virus protection.
Virtual Desktops & Snap Layouts – Organize workspaces easily
(Windows 10/11).
DirectX & Gaming – Optimized for gaming, especially with Xbox
integration.
Microsoft Store – Download apps, games, and software.
What is System Programming?
System programming refers to the process of writing software
that interacts directly with the operating system and hardware.
It focuses on managing system resources such as memory,
files, and processes. Unlike application programming (which
deals with user-facing applications), system programming
works behind the scenes to ensure efficient system operation.

•Key Aspects of System Programming:


• Direct interaction with the OS and hardware.
• Managing low-level operations like memory management
and file handling.
• Writing performance-critical software, such as operating
systems, device drivers, and networking tools.
Understanding Operating Systems
An Operating System (OS) is software that manages
hardware resources and provides services to
applications. It handles memory management
involving RAM and virtual memory, file systems for
file storage, retrieval, and permissions, processor
scheduling which allocates CPU time to processes,
multitasking allowing multiple applications to run
simultaneously, and security and user access control.
Windows OS provides these core features through
the Windows API, enabling developers to interact
seamlessly with
Memory: The OS system
manages resources.
a large, flat, virtual memory address space
and transparently moves information between physical memory and disk
and other secondary storage.

File systems: The OS manages a hierarchical, named file


space and provides both direct and sequential access as
well as directory and file management
processors: The OS must efficiently allocate computational task to
processors and multiple processors are increasingly common on even
the smallestUnderstanding
computers Operating Systems
Resource naming and location :The OS uses a naming system for
files, devices, and processes, making it easier to organize and manage
access to resources..
Multitasking: The OS must manage processes, threads, and other
units of independent, asynchronous execution. Tasks can be preempted
and scheduled according to dynamically calculated priorities.
Communication and synchronization: The OS manages task-to-task
communication and synchronization within single computers as well as
communication between networked computers and with the Internet

Security and protection: The OS provides flexible mechanisms to


protect resources from unauthorized and accidental access and
corruption
Windows Evolution
Windows has evolved over time while maintaining a stable API that
ensures compatibility across different versions. Key aspects of its
evolution include:

•Scalability: Supports a wide range of systems, from personal


computers to enterprise servers.
•Performance: Internal improvements and new API features
enhance system efficiency.
•Integration: New technologies such as multimedia, networking, and
.NET are incorporated into each version.
•Ease of Use: The graphical interface and user experience improve
with each release.
•Enhanced API: Continuous updates introduce new API
functionalities while keeping core compatibility intact.
Evolution of Windows OS
1 Windows 11 (2021)
Modern UI, better multitasking, gaming enhancements,
and AI integration.
2 Windows 10 (2015)

Classic Start menu returns, frequent updates,


improved security, and performance.
3 Windows 7 (2009)

Improved performance, better UI, enhanced security


features.
4 Windows XP (2001)
Highly stable, widely used, marking a significant
milestone.
5 Windows 2000/NT (1993-1999)
Built for professional use, introducing
NTFS for enhanced stability, scalability,
and security.
Windows Architecture
Windows operating system is built on a modular architecture that ensures
stability, performance, and security. It follows a hybrid kernel model, combining
features of monolithic and microkernel designs to b alance flexibility and
efficiency.
hybrid kernel model: is a type of operating system kernel that combines
features of both monolithic and microkernels.
Major Components of Windows Architecture
A. User Mode
User mode is where most applications and system processes run, providing an abstraction layer that
prevents direct hardware access.
It consists of:
 Applications – Software programs that interact with users, such as Microsoft Word or Google
Chrome.
 Subsystems – Provide an interface between applications and the operating system.
• Windows API Subsystem – Handles GUI applications.
• POSIX Subsystem (deprecated) – Provided compatibility with UNIX.
• WOW64 – Allows 32-bit applications to run on 64-bit Windows.
 Environment Subsystems – Support different application models, such as Win32, .NET, and
Windows Services.
 System Services – Functions that allow applications to request OS operations.
Major Components of Windows Architecture
B. Kernel Mode
Kernel mode has full access to system resources and controls hardware interaction. It consists of:
 Executive Services – Core system management functions, including:
Process Manager – Controls process creation and termination.
• Memory Manager – Manages physical and virtual memory.
• I/O Manager – Handles input/output device communication.
• Security Manager – Implements user authentication and access control.
 Kernel – Manages low-level operations like scheduling, interrupts, and system synchronization.
 HAL (Hardware Abstraction Layer) – Provides a standardized interface between the kernel and
physical hardware, enabling compatibility
across different hardware architectures.
Windows API
Windows API (WinAPI) is a set of functions provided by Microsoft that allows
software applications to interact with the Windows operating system. It provides a
bridge between user applications and system-level operations, enabling
developers to perform tasks like file management, process control, memory
allocation, and graphical rendering.

•Why is Windows API Important?


• Direct access to system resources (memory, files, processes, etc.).
• Standardized way to develop applications compatible across Windows
versions.
• Used in system software, utilities, games, and enterprise applications.
Windows API
Windows API is divided into several functional groups, each handling different aspects
of system interaction:

1.Process & Thread Management


•CreateProcess() – Creates a new process.
•TerminateProcess() – Ends a process.
•GetCurrentProcessId() – Retrieves the process ID of the calling process.
•CreateThread() – Creates a new thread.
•Sleep() – Pauses execution for a given time.
2.File System Management
•CreateFile() – Opens or creates a file.
•ReadFile() / WriteFile() – Reads/writes data to a file.
•DeleteFile() – Deletes a file.
•GetFileAttributes() – Retrieves file properties.
Windows API
4.Memory Management
• VirtualAlloc() – Allocates memory.
• VirtualFree() – Frees allocated memory.
• HeapCreate() / HeapDestroy() – Manages memory heaps.
5.Device & Hardware Interaction
• DeviceIoControl() – Sends control codes to device drivers.
• GetSystemMetrics() – Retrieves system information like screen size.
6.Window & GUI Management
• CreateWindowEx() – Creates a new window.
• ShowWindow() – Displays a window.
• MessageBox() – Displays a simple message box.
7.Networking & Communication
• WSAStartup() – Initializes network sockets.
• send() / recv() – Sends and receives data over a network.
• gethostbyname() – Resolves a domain name to an IP address.
8.Security & User Authentication
• LogonUser() – Verifies a user’s credentials.
• OpenProcessToken() – Retrieves access tokens for security checks.
Processor Support in Windows
Windows is designed to work on different types of computer
processors. It uses a Hardware Abstraction Layer (HAL) to make it
easier to run on various processor architectures. However, this is
something that software developers usually don’t need to worry about.
Here’s how Windows supports different processors:
•Intel x86 (32-bit) and x64 (64-bit): Most Windows versions run on
Intel's x86 processors and their 64-bit extensions (x64). AMD’s 64-bit
processors are also compatible.
•Intel Itanium (IA-64): Some older Windows Server versions were
designed to run on Itanium IA-64, which is very different from x86
processors, but it's not widely used today.
32-bit vs. 64-bit Windows Programming
Feature 32-bit (Win32) 64-bit (Win64)

Memory Addressing Max 4GB Larger memory access

Pointer Size 4 bytes 8 bytes

Performance Limited for large applications Better performance & security

File Handling Supports large files (64-bit More efficient


functions needed)

Windows supports both 32-bit (Win32) and 64-bit (Win64) applications. 32-bit applications have a max 4GB
memory addressing, 4-byte pointer size, and limited performance for large applications. 64-bit applications
have larger memory access, 8-byte pointer size, and better performance and security. 32-bit supports large
files using 64-bit functions, while 64-bit is more efficient. Use data types that support both architectures, e.g.,
SIZE_T instead of int for memory sizes.
Advantages of Windows Development

Large User Base Standardized APIs Scalability

High demand for Windows applications Enables developers to write code once Supports desktops, servers, and
due to its widespread adoption. and run on multiple Windows versions. embedded systems, making it versatile
for various applications.
Windows dominates personal computing (desktops, laptops), enterprise solutions (business servers, cloud services), and
embedded/industrial applications. The large user base drives high demand for Windows applications. Standardized APIs allow
developers to write code once and run on multiple Windows versions. It also has scalability, supporting desktops, servers, and
embedded systems. Robust developer support includes Visual Studio, MSDN, and the .NET framework.

You might also like