00->1
Learning pathStep 5 of 62Foundations ← All writeups

Operating Systems and Windows Basics, Explained

If you are reading this, you have probably used Windows every day and Linux for a few commands, and you want to understand what is actually going on underneath, because almost every attack and defence in security happens inside an operating system.

By the end you will be able to explain what an operating system does, the difference between user mode and kernel mode, what a process, a thread and virtual memory are, how Windows decides who may do what (accounts, SIDs, access tokens and ACLs), what UAC, services, the registry and event logs are for, how a virtual machine differs from a container, and what "hardening" means. It builds on Computer and Networking Basics and Linux Fundamentals.

How to use this guide: if you have a Windows PC, open Command Prompt and PowerShell and type the commands in section 8. If you only have Linux, read the Windows parts for the concepts and use the Linux equivalents shown in the comparison table. Run commands only on a computer you own or are allowed to administer.


1. What an operating system does

NIST's glossary describes an operating system as "the software 'master control application' that runs the computer. It is the first program loaded when the computer is turned on, and its main component, the kernel, resides in memory at all times." Applications "communicate with the operating system for most user interface and file management operations."

In practice the OS does five jobs for you:

Job What it means
Runs programs Starts them, shares the processor between them, stops them
Manages memory Gives each program its own memory and keeps programs out of each other's
Manages storage Organises data into files and folders on a file system
Controls devices Talks to disks, network cards and screens through drivers
Enforces security Decides who is allowed to read, write or run what

The fifth job is the one that matters most to this blog. An operating system is where logins are checked, permissions enforced and logs written, and where privilege escalation happens when something goes wrong.


2. Kernel mode and user mode

The kernel is the core of the OS. It has direct access to hardware and memory. Everything else runs with fewer rights, so one broken program cannot take down the whole machine.

Microsoft's driver documentation puts it this way: "A processor in a computer that runs Windows operates in two different modes: user mode and kernel mode. The processor switches between these modes depending on the type of code it's executing. Applications operate in user mode. Core operating system components function in kernel mode."

User mode Kernel mode
Who runs here Your applications Core OS components and many drivers
Memory Each application gets a private virtual address space "All code that runs in kernel mode shares a single virtual address space"
If it crashes "if an application crashes, it doesn't affect other applications or the operating system" "If a kernel-mode driver crashes, it causes the entire operating system to crash"
Security view Contained A bug here can break every protection above it

This is why drivers are a security concern: they run with kernel-level power, so a flaw in one can give an attacker control of the whole system. It is also the idea behind least privilege: keep as little code as possible in the most powerful place.

Linux uses the same split. Programs ask the kernel for services through system calls; the Linux manual page calls the system call "the fundamental interface between an application and the Linux kernel."


3. Processes, threads and memory

Processes and threads

Microsoft's definitions: "A process, in the simplest terms, is an executing program. One or more threads run in the context of the process. A thread is the basic unit to which the operating system allocates processor time."

A useful picture: a process is a running copy of a program with its own memory and identity (a number called the process ID, PID); a thread is one line of execution inside it. A browser may run many processes, each with several threads.

On Linux every process also has a unique PID (the credentials(7) manual page: "Each process has a unique nonnegative integer identifier that is assigned when the process is created"). You met ps and kill in Linux Fundamentals; Windows has tasklist and taskkill.

Virtual memory

Programs do not see the computer's real memory addresses. Microsoft explains: "The virtual address space for a process is the set of virtual memory addresses that it can use. The address space for each process is private and cannot be accessed by other processes unless it is shared." The system keeps "a page table for each process" that translates virtual addresses into physical ones.

This is the main reason one buggy program cannot normally read another's secrets. Many attacks you will meet later (buffer overflows, for example) are attempts to make a program misbehave inside its own memory, because reaching other memory is blocked.

Services (daemons)

Some programs run in the background without anyone logged in. On Windows they are called services: "Services can execute even when no user is logged on to the system," and can start "automatically at system boot." On Linux they are daemons, controlled with systemctl. Because services often run with high privilege and start automatically, attackers like them and defenders audit them.


4. File systems and permissions

A file system organises data on a disk. Windows uses NTFS, which Microsoft calls "the default file system for modern Windows-based operating system (OS)" and which includes "security descriptors, encryption, disk quotas, and support for rich metadata." Linux commonly uses ext4 and others; macOS uses APFS. The important point is that each file carries information saying who may do what.

  • Linux: owner, group and everyone else, each with read, write and execute (rwx), as in the permissions section of Linux Fundamentals.
  • Windows (NTFS): an access control list (ACL). Microsoft: "An access control list (ACL) is a list of access control entries (ACE). Each ACE in an ACL identifies a trustee and specifies the access rights allowed, denied, or audited for that trustee."

There are two kinds of ACL. A DACL (discretionary) "identifies the trustees that are allowed or denied access to a securable object." A SACL (system) "allows administrators to log attempts to access a secured object." Two details worth remembering from Microsoft's page: "If the object doesn't have a DACL, the system grants full access to everyone. If the object's DACL has no ACEs, the system denies all attempts to access the object." An empty list and a missing list are opposites, which is a classic source of mistakes.


5. Windows accounts, SIDs and access tokens

This is the part of Windows security that beginners most often skip, and the part that makes later topics (privilege escalation, pass-the-hash, Active Directory attacks) make sense.

Security identifiers (SIDs)

Windows does not track users by name internally. Microsoft: "A SID is used to uniquely identify a security principal or security group." It "can never be used again to identify another user or group." Renaming an account does not change its SID.

Some SIDs are well known. For example S-1-5-18 is the System (LocalSystem) identity, "used locally by the operating system and by services that are configured to sign in as LocalSystem," and Microsoft notes that "System is a hidden member of Administrators."

Built-in local accounts

Account What it is
Administrator "The default local Administrator account is a user account that's intended for system administration." It has full control of the machine, can't be deleted or locked out, and "Windows setup disables the built-in Administrator account and creates another local account that is a member of the Administrators group."
Guest Disabled by default, with a blank password; "Because the Guest account can provide anonymous access, it's considered a security risk."
SYSTEM Used by the operating system and by services; it has Full Control on NTFS volumes by default and "can't be added to any groups"

Access tokens

When you sign in, Windows creates an access token. Microsoft: "An access token is an object that describes the security context of a process or thread. The information in a token includes the identity and privileges of the user account associated with the process or thread." It includes the user's SID, the SIDs of their groups, and the list of privileges. "Every process executed on behalf of this user has a copy of this access token."

So when a process tries to open a file, Windows compares the token (who is asking and what groups they belong to) with the file's DACL (who is allowed). This is the authorisation step from Authentication vs Authorization in action: authentication created the token, and every later access is checked against it.

Because the token represents the user's power, stealing or copying a token is a classic way to act as someone else.


6. UAC: why administrators do not always run as administrator

User Account Control (UAC) reduces the damage a program can do even when an administrator runs it. Microsoft: "UAC reduces the risk of malware by limiting the ability of malicious code to execute with administrator privileges."

How it works:

  1. When an administrator signs in, "two separate access tokens are created": a standard user token and an administrator token.
  2. The standard token has "the administrative Windows privileges and SIDs ... removed" and is used to run the desktop (explorer.exe), so ordinary apps start with ordinary rights.
  3. When something needs administrator rights, Windows shows a consent prompt (or a credential prompt for a standard user), displayed on the secure desktop by default, which "only Windows processes can access."

Windows also uses integrity levels as "measurements of trust": a web browser is an example of a lower-integrity application, and "applications with lower integrity levels can't modify data in applications with higher integrity levels."

The point to take away: UAC is least privilege and separation applied to the desktop. It does not stop all malware, and Microsoft's own page warns that "malware can present an imitation of the secure desktop," but it removes the easy path where any program silently has full control.


7. The registry, logs and domains

The registry

The registry is "a system-defined database in which applications and system components store and retrieve configuration data." Windows keeps settings here (startup programs, service settings, security options) that Linux usually keeps in text files under /etc. Microsoft warns: "You should not edit registry data that does not belong to your application unless it is absolutely necessary. If there is an error in the registry, your system may not function properly." Attackers use the registry for persistence (making malware start again after reboot), so defenders watch certain startup locations.

Event logs

Windows records important events in event logs. Microsoft's documentation describes event logging as "a standard, centralized way for applications (and the operating system) to record important software and hardware events," and Event Viewer is the tool to read them. The Security log records sign-ins and, if enabled through a SACL or audit policy, file access. On Linux the equivalent is the logs under /var/log and journalctl. Logs are what turn an incident from a mystery into something you can investigate; see Security Operations.

Active Directory and Group Policy (enterprise Windows)

In a company, Windows computers are usually joined to a domain. Microsoft: "A directory service, such as Active Directory Domain Services (AD DS), provides the methods for storing directory data and making this data available to network users and administrators. For example, AD DS stores information about user accounts, such as names, passwords, phone numbers, and so on."

Group Policy then pushes settings to many computers at once. Microsoft: "Group Policy enables policy-based administration using Microsoft Active Directory directory services." Together they let one administrator say "every laptop must lock after five minutes" and have it applied everywhere. Because one directory controls so many machines, it is a high-value target, which is why Active Directory security is a whole specialism you will meet later.


8. Try it: look at your own Windows system

Use Command Prompt or PowerShell. Everything below only reads information.

Command What it shows
whoami /user "the current domain and user name and the security identifier (SID)"
whoami /groups The groups your token belongs to
whoami /priv The privileges in your token
tasklist "a list of currently running processes"
tasklist /svc Which services run inside each process
Get-Process (PowerShell) "the processes on a local computer"
Get-Service (PowerShell) "the services on a computer, including running and stopped services"
icacls C:\Windows\System32\drivers\etc\hosts The DACL on that file: who has which rights (F full, M modify, RX read and execute, R read)
reg query HKCU\Software "a list of the next tier of subkeys and entries" under that registry key

Things to notice:

  1. Run whoami /groups in a normal window, then in one opened with Run as administrator. The token is different.
  2. Run icacls on a file in your own folder and on a file in C:\Windows. Compare who can modify each.
  3. Run tasklist /svc and pick one entry. Search the service name in Microsoft's documentation to see what it is for.

Linux equivalents: id (your user and groups), ps aux (processes), systemctl list-units --type=service (services), ls -l (permissions), journalctl (logs).


9. Windows and Linux side by side

Idea Windows Linux
Most powerful account SYSTEM (internal), Administrator root
Temporary elevation UAC prompt sudo
Who may do what on a file ACL (DACL) owner, group, other and rwx
Process list tasklist, Get-Process, Task Manager ps, top
Background programs Services Daemons, controlled by systemctl
Settings Registry and policy Text files under /etc
Logs Event Viewer, Event Log /var/log, journalctl
Package or software install MSI, Microsoft Store, winget apt, dnf and others
Central management Active Directory and Group Policy Configuration management tools

Linux also divides root's power into smaller pieces. The Linux manual page for capabilities: "Starting with Linux 2.2, Linux divides the privileges traditionally associated with superuser into distinct units, known as capabilities, which can be independently enabled and disabled." That is least privilege applied to the superuser itself.


10. Virtual machines and containers

You will use both in this blog's labs, so it helps to know the difference.

Virtual machines. NIST SP 800-125: "Virtualization is the simulation of the software and/or hardware upon which other software runs. This simulated environment is called a virtual machine (VM)." In full virtualization, "each instance of an OS and its applications runs in a separate VM called a guest operating system," and the guests "are managed by the hypervisor," which "controls the flow of instructions between the guest OSs and the physical hardware." Each VM has its own complete OS.

Containers. NIST SP 800-190: "With containers, multiple apps share the same OS kernel instance but are segregated from each other." Containers are "OS-family specific; a Linux host can only run containers built for Linux, and a Windows host can only run Windows containers." On Linux the separation is built from features such as namespaces ("a namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource") and cgroups ("control groups ... allow processes to be organized into hierarchical groups whose usage of various types of resources can then be limited and monitored").

Virtual machine Container
Has its own kernel Yes (a full guest OS) No: shares the host's kernel
Isolation "hardware-level isolation" through the hypervisor Process-level isolation by the shared kernel
Start-up and size Heavier Lighter
Security note A hypervisor flaw can affect every guest A kernel flaw can affect every container

NIST also lists downsides of virtualization worth remembering: it "adds layers of technology, which can increase the security management burden," and "combining many systems onto a single physical computer can cause a larger impact if a security compromise occurs." And for containers it advises using "container-specific host OSs instead of general-purpose ones to reduce attack surfaces."


11. Hardening and keeping Windows safe

NIST's glossary defines hardening as "a process intended to eliminate a means of attack by patching vulnerabilities and turning off nonessential services." For an operating system, the practical checklist is:

Step Why
Keep it supported and updated Unpatched software is the easiest way in. Windows 10 reached end of support on 14 October 2025, so a computer still on it no longer receives regular security updates from Microsoft's standard programme
Use a standard account day to day Least privilege; malware starts with less power
Keep UAC on The consent prompt is the last check before a program gains administrator rights
Turn off what you do not use Fewer services and features mean a smaller attack surface (see Security Design Principles)
Encrypt the disk BitLocker protects against data theft "from lost, stolen, or inappropriately decommissioned devices"
Keep Secure Boot on Microsoft: "the firmware checks the signature of each piece of boot software" so that the PC boots only software trusted by the manufacturer
Follow a baseline Microsoft says a security baseline is "a group of Microsoft-recommended configuration settings that explains their security implication," and notes there are "over 3,000 group policy settings for Windows 10"
Turn on logging and watch it You cannot investigate what was never recorded

Besides Microsoft's baselines, the nonprofit Center for Internet Security (CIS) publishes consensus configuration guides called CIS Benchmarks for many operating systems. Use them as reference checklists; apply changes to a test machine first, because tightening settings can break software.


12. Common mistakes

Mistake The better view
"Windows has no permissions like Linux" It has a richer system: SIDs, tokens and ACLs
"Administrator and SYSTEM are the same" Both are very powerful, but SYSTEM is an internal identity used by the OS and services
"Antivirus means I do not need updates" Patching removes the hole; antivirus tries to catch what comes through
"Containers are just small VMs" They share the host kernel; a VM has its own
"A hidden file or registry key is secret" Hiding is not a control; permissions are
"Disabling UAC makes things easier, no harm" It removes a layer that stops silent elevation
"Editing the registry is how you learn Windows" Edit only on a test VM; wrong changes can stop the system booting

Closing

An operating system is the referee between programs, users and hardware. It separates user mode from kernel mode, gives each process its own virtual memory, stores data in a file system with permissions, and decides every access using the identity in your token. On Windows that means SIDs, access tokens, ACLs and UAC; on Linux it means users, groups, permissions and sudo; in both, services, logs and updates are where defence lives.

Keep these points:

  • User mode is contained; kernel mode is trusted, so drivers and kernel bugs matter a lot.
  • A process is a running program; a thread is a line of execution inside it.
  • Windows decides access by comparing the token with the object's ACL.
  • UAC splits an administrator's token so programs run without full power by default.
  • The registry and services are persistence spots that attackers and defenders both look at.
  • VMs have their own kernel; containers share the host's.
  • Hardening means supported, patched, minimal, encrypted and logged.

Next: Git and GitHub, Explained uses the terminal skills you now have to track and share work.

If you can run whoami /groups, explain what each part of the output means, and say what would happen if a process with that token tried to open a file whose ACL does not list any of those groups, you understand this writeup.