Objective
See processes on your own PC: their IDs, memory, handles, threads, parents and loaded DLLs. You only look (and start and close Notepad). Nothing in this lab changes a Windows setting.
Time: 25–30 minutes
You need: A Windows PC. No extra software is required. (One free optional tool is named in Part 5.)
What to Open
| Tool | How to open it |
|---|---|
| Task Manager | Press Ctrl + Shift + Esc |
| PowerShell | Press Win, type PowerShell, press Enter (normal, not admin) |
| Command Prompt | Press Win, type cmd, press Enter |
| Resource Monitor | Press Win + R, type resmon, press Enter |
Part 1: The Processes Tab and Details Tab (Task Manager)
-
Open Task Manager. On the Processes tab, count the entries under Apps and under Background processes and Windows processes.
-
Open Notepad (and leave it open). Find it under Apps.
-
Switch to the Details tab. Right-click any column header and choose Select columns. Tick: PID, Threads, Handles, Memory (private working set), Commit size, Command line, User name, Elevated (and Status if you like).
-
Find
notepad.exe. Fill in:- PID of Notepad: ________________
- Threads: ________________
- Handles: ________________
- Memory (private working set): ________________
- User name: ________________
- Status (Running or Suspended): ________________
-
Click the PID header to sort. Look at the top: System Idle Process has PID 0 and System has PID 4 (Section 5.1).
Part 2: The Same Facts From the Command Line
Type each line and press Enter:
Get-Process notepad | Select-Object Name, Id, Handles, Threads
tasklist /FI "IMAGENAME eq notepad.exe"- Is the PID the same as in Task Manager? ________________
Now start a second Notepad and compare:
Start-Process notepad
Get-Process notepad | Select-Object Id, StartTime, WorkingSet64- How many Notepad processes are there now? ________________
- Are the PIDs different? (One program file, two processes, Section 1.2) ________________
Part 3: Memory Per Process
Get-Process | Sort-Object WorkingSet64 -Descending |
Select-Object -First 5 Name, Id, @{n="WorkingSetMB";e={[int]($_.WorkingSet64/1MB)}}- Which program uses the most memory? ________________ How many MB? ________________
- In Task Manager, compare Working set and Commit size for it. Which is bigger? ________________ (Section 4.1)
Part 4: Parent and Child
Get-CimInstance Win32_Process -Filter "Name='notepad.exe'" |
Select-Object ProcessId, ParentProcessId, CommandLine- What is the ParentProcessId of Notepad? ________________
- Find that PID in the Details tab. Which program is the parent? ________________ (Probably
explorer.exe, orpowershell.exeif you started it from there.)
Orphan test (safe). In PowerShell type:
$p = Start-Process powershell -PassThru
$p.IdA new PowerShell window opens. Note its PID, then in the new window run:
Get-CimInstance Win32_Process -Filter "ProcessId=$PID" | Select-Object ParentProcessIdNow close the first PowerShell window (the parent). Look in Task Manager.
- Is the second window still running? ________________
- Does its recorded parent PID still show the same number? ________________ (Section 10.1: no re-parenting on Windows)
Part 5: Handles and Modules
- In the Details tab, sort by Handles (click the header twice for highest first). Which process has the most? ________________
- List the DLLs loaded in Notepad:
(Get-Process notepad | Select-Object -First 1).Modules | Select-Object ModuleName | Select-Object -First 15- Do you see
ntdll.dllandkernel32.dll? ________________ (Section 8.1)
Optional: Sysinternals Process Explorer (free from Microsoft, optional). It is not part of Windows; download it only from Microsoft's official site. It shows the process tree, the handles of each process, and the DLL list in a lower pane (View, Lower Pane View, Handles or DLLs).
Part 6: Watch a Process End
$p = Start-Process notepad -PassThru
$p.Id
Stop-Process -Id $p.Id- Did Notepad vanish at once with no "save changes" question? ________________ (Section 3.2: forceful end, no cleanup)
For an exit code in Command Prompt:
cmd /c exit 7
echo %ERRORLEVEL%
- What number prints? ________________ (Section 3.1)
What Should Happen
- Part 1 and 2 show the same PID for Notepad.
- Part 2 shows two different PIDs for two Notepad windows.
- Part 4 shows the parent as Explorer (or the shell that started it). The orphaned PowerShell keeps running after the parent closes.
- Part 5 shows
ntdll.dllandkernel32.dllin every process's module list. - Part 6 prints
7.
Interpretation Guide
| What you see | What it means |
|---|---|
| A process with 0% CPU | Blocked or ready, not running (Section 7) |
| Status: Suspended on an app | A Store app frozen in the background |
| Handles keeps rising for one process | Possible handle leak (Section 5.3) |
| Private working set keeps rising | Possible memory leak (Section 4.4) |
(32 bit) after a name | A 32-bit program on 64-bit Windows (WOW64) |
| ParentProcessId points to nothing in the list | Parent already exited: an orphan (Section 10.1) |
Many svchost.exe entries | Windows service host processes. Normal |
| Elevated: Yes | The process runs as an administrator |
Follow-Up Questions
- Why are the two Notepads separate processes even though they use the same file?
- Why can the same PID later belong to a different program?
- Name two things that Task Manager's Details tab shows that the Processes tab does not.
- When you closed the parent PowerShell, why did the child keep running?
- Which is bigger on your PC, a process's commit size or its private working set, and what does the difference mean?