900193479 Lab Process Management Exercise Win10
900193479 Lab Process Management Exercise Win10
Turn-in Sheet
1. Put the “tasklist” results here (give the PID for “notepad” _____8044_____ ):
SUCCESS: Sent termination signal to the process "Notepad.exe" with PID 8044.
The number of threads increases to 22 when a new tab is created, and to 27 when 4
tabs are created.
The change in the number of threads reflects the fact that Notepad requires
additional resources to manage more activity. When only one tab is open, fewer
threads are needed because the program only has to handle user input and display
for one document. As more tabs are opened, each tab may require one or more
separate threads to update its contents and respond to user actions in real time.
Therefore, as the number of tabs increases, the overall number of threads increases
accordingly.
5. Copy of “Resource Monitor”:
2908
7660
7904
6116
7088
7628
3820
8728
2560
5952
6652
3732
4604
2128
1668
7820
8428
9108
8012
4324
3576
3220
6696
4668
6080
2016
8876
1572
2928
2012
6068
4308
5772
8172
4824
7220
8472
6992
9188
5736
8588
7392
2708
5168
8512
7308
5508
280
5040
5272
7288
________________________________________________________
7. [Optional] pslist results and Explanation of difference between User Time and Kernel
Time:
If I run pslist, I’ll get details about the processes running on my system, including user time
and kernel time. User time refers to the time that my process spends executing in user
mode. User mode restricts the process from accessing critical parts of the operating system
and hardware, meaning that most of the computation and logic processing that the
application does happens in this mode.
Kernel time, on the other hand, refers to the time the process spends executing in kernel
mode. This involves interactions with the core of the operating system, like I/O operations,
system calls, or other tasks that require direct OS support. If I notice a process with
unusually high kernel time, it could indicate that it’s engaged in extensive low-level
operations, or there might be system-level bottlenecks.
Understanding the difference between user time and kernel time is important for me
because it helps identify where the process spends most of its execution time. For instance,
high kernel time might prompt me to review the I/O strategy of my program or investigate
potential system-level issues.
8. [Optional] Explain how you might use these tools and techniques to make a change
to a Windows program:
Knowing how to use tools like pslist, Process Explorer, and Resource Monitor gives me a
powerful suite of diagnostic utilities to identify performance bottlenecks in a Windows
program. For instance, if I detect that a program has high CPU usage, I might use Process
Explorer to delve deeper into its thread activity. This can lead me to identify inefficient code
paths or threads that are causing contention.
Furthermore, with pslist, I can monitor the process over time and log its performance
metrics for later analysis. This information could be crucial in optimizing the program, as I
can spot trends and patterns that aren't immediately obvious.
These tools can also help me understand the resources my program uses most. If memory
usage is high, I might investigate memory leaks or inefficient memory allocation. Conversely,
if disk I/O is high, it could mean that my program is reading or writing to the disk too
frequently or that it's handling file operations inefficiently.
Ultimately, these tools allow me to make informed decisions about where to make changes
in a Windows program. By pinpointing exact resource usage and how the program behaves
over time, I can refactor, optimize, and improve the program's performance and stability.
10. Results from “grep” of the password file, and full copy of the file.
##
# User Database
# Note that this file is consulted directly only when the system is running
# Open Directory.
# Open Directory.
##
nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false
root:*:0:0:System Administrator:/var/root:/bin/sh
daemon:*:1:1:System Services:/var/root:/usr/bin/false
_networkd:*:24:24:Network Services:/var/networkd:/usr/bin/false
_installassistant:*:25:25:Install Assistant:/var/empty:/usr/bin/false
_lp:*:26:26:Printing Services:/var/spool/cups:/usr/bin/false
_mcxalr:*:54:54:MCX AppLaunch:/var/empty:/usr/bin/false
_appleevents:*:55:55:AppleEvents Daemon:/var/empty:/usr/bin/false
_devdocs:*:59:59:Developer Documentation:/var/empty:/usr/bin/false
_sandbox:*:60:60:Seatbelt:/var/empty:/usr/bin/false
_mdnsresponder:*:65:65:mDNSResponder:/var/empty:/usr/bin/false
_cvs:*:72:72:CVS Server:/var/empty:/usr/bin/false
_svn:*:73:73:SVN Server:/var/empty:/usr/bin/false
_mysql:*:74:74:MySQL Server:/var/empty:/usr/bin/false
_cyrus:*:77:6:Cyrus Administrator:/var/imap:/usr/bin/false
_appserver:*:79:79:Application Server:/var/empty:/usr/bin/false
_clamav:*:82:82:ClamAV Daemon:/var/virusmails:/usr/bin/false
_amavisd:*:83:83:AMaViS Daemon:/var/virusmails:/usr/bin/false
_appowner:*:87:87:Application Owner:/var/empty:/usr/bin/false
_windowserver:*:88:88:WindowServer:/var/empty:/usr/bin/false
_spotlight:*:89:89:Spotlight:/var/empty:/usr/bin/false
_tokend:*:91:91:Token Daemon:/var/empty:/usr/bin/false
_securityagent:*:92:92:SecurityAgent:/var/db/securityagent:/usr/bin/false
_calendar:*:93:93:Calendar:/var/empty:/usr/bin/false
_teamsserver:*:94:94:TeamsServer:/var/teamsserver:/usr/bin/false
_update_sharing:*:95:-2:Update Sharing:/var/empty:/usr/bin/false
_installer:*:96:-2:Installer:/var/empty:/usr/bin/false
_atsserver:*:97:97:ATS Server:/var/empty:/usr/bin/false
_ftp:*:98:-2:FTP Daemon:/var/empty:/usr/bin/false
_unknown:*:99:99:Unknown User:/var/empty:/usr/bin/false
_softwareupdate:*:200:200:Software Update
Service:/var/db/softwareupdate:/usr/bin/false
_screensaver:*:203:203:Screensaver:/var/empty:/usr/bin/false
_locationd:*:205:205:Location Daemon:/var/db/locationd:/usr/bin/false
_timezone:*:210:210:AutoTimeZoneDaemon:/var/empty:/usr/bin/false
_cvmsroot:*:212:212:CVMS Root:/var/empty:/usr/bin/false
_dovecot:*:214:6:Dovecot Administrator:/var/empty:/usr/bin/false
_dpaudio:*:215:215:DP Audio:/var/empty:/usr/bin/false
_postgres:*:216:216:PostgreSQL Server:/var/empty:/usr/bin/false
_netbios:*:222:222:NetBIOS:/var/empty:/usr/bin/false
_warmd:*:224:224:Warm Daemon:/var/empty:/usr/bin/false
_dovenull:*:227:227:Dovecot Authentication:/var/empty:/usr/bin/false
_launchservicesd:*:239:239:_launchservicesd:/var/empty:/usr/bin/false
_iconservices:*:240:240:IconServices:/var/empty:/usr/bin/false
_distnote:*:241:241:DistNote:/var/empty:/usr/bin/false
_nsurlsessiond:*:242:242:NSURLSession
Daemon:/var/db/nsurlsessiond:/usr/bin/false
_astris:*:245:245:Astris Services:/var/db/astris:/usr/bin/false
_mbsetupuser:*:248:248:Setup User:/var/setup:/bin/bash
_wwwproxy:*:252:252:WWW Proxy:/var/empty:/usr/bin/false
_mobileasset:*:253:253:MobileAsset User:/var/ma:/usr/bin/false
_findmydevice:*:254:254:Find My Device
Daemon:/var/db/findmydevice:/usr/bin/false
_datadetectors:*:257:257:DataDetectors:/var/db/datadetectors:/usr/bin/false
_captiveagent:*:258:258:captiveagent:/var/empty:/usr/bin/false
_ctkd:*:259:259:ctkd Account:/var/empty:/usr/bin/false
_applepay:*:260:260:applepay Account:/var/db/applepay:/usr/bin/false
_cmiodalassistants:*:262:262:CoreMedia IO Assistants
User:/var/db/cmiodalassistants:/usr/bin/false
_analyticsd:*:263:263:Analytics Daemon:/var/db/analyticsd:/usr/bin/false
_fpsd:*:265:265:FPS Daemon:/var/db/fpsd:/usr/bin/false
_reportmemoryexception:*:269:269:ReportMemoryException:/var/db/
reportmemoryexception:/usr/bin/false
_driverkit:*:270:270:DriverKit:/var/empty:/usr/bin/false
_diskimagesiod:*:271:271:DiskImages IO
Daemon:/var/db/diskimagesiod:/usr/bin/false
_logd:*:272:272:Log Daemon:/var/db/diagnostics:/usr/bin/false
_installcoordinationd:*:274:274:Install Coordination
Daemon:/var/db/installcoordinationd:/usr/bin/false
_demod:*:275:275:Demo Daemon:/var/empty:/usr/bin/false
_accessoryupdater:*:278:278:Accessory Update
Daemon:/var/db/accessoryupdater:/usr/bin/false
_knowledgegraphd:*:279:279:Knowledge Graph
Daemon:/var/db/knowledgegraphd:/usr/bin/false
_coreml:*:280:280:CoreML Services:/var/empty:/usr/bin/false
_trustd:*:282:282:trustd:/var/empty:/usr/bin/false
_darwindaemon:*:284:284:Darwin Daemon:/var/db/darwindaemon:/usr/bin/false
_notification_proxy:*:285:285:Notification Proxy:/var/empty:/usr/bin/false
_oahd:*:441:441:OAH Daemon:/var/empty:/usr/bin/false
Explain two ways you can be sure the process was terminated?
1. Check if the Process Is Still Running
```bash
ps -ef | grep 1234
```
If the process 1234 does not exist, I will get an error message
like `bash: kill: (1234) - No such process`, indicating that the
process no longer exists. If there is no error message, it means
the process is still running.
1. R (Running or Runnable): This status means the process is either currently running on a
CPU or is ready to run as soon as it gets CPU time. I use this status to identify processes that
are actively executing or are set to be executed immediately.
2. S (Interruptible Sleep): This status indicates that the process is waiting for an event to
complete or for a resource to become available. It’s in a sleep state, meaning it’s not doing
any work but can be started again immediately once the required resource is free or the
event it’s waiting for happens. I see this status often for processes that are dependent on
disk I/O operations or waiting for user input.
3. D (Uninterruptible Sleep): Unlike the interruptible sleep state, processes in this state are
sleeping in a way that they can’t be interrupted by signals until they complete their task.
Typically, this is related to core system operations, like interacting directly with hardware
components. I note this status for processes that might be handling critical system tasks.
4. T (Stopped):*This status appears when a process has been stopped, usually by receiving a
signal. This can happen if I’ve manually paused the process or if it’s being debugged.
Processes can be resumed from this state.
5. Z (Zombie): When a process has completed its execution but still has an entry in the
process table because the parent process hasn’t yet read its exit status, it’s in a zombie
state. This is like a placeholder that indicates the process is finished but is still being
referenced by the system to relay its completion status to its parent process.
6. X (Dead): This is a less commonly seen status, indicating that the process is being removed
from memory. It’s a transitional state before the process is completely cleared from the
system.
The top command: This command provides a real-time view of the current processes
in the system and their status, including CPU utilization, memory usage, runtime,
etc. The output of the top command is dynamic and will be updated over time. This
is very useful for monitoring system performance and finding possible performance
bottlenecks.
The pstree command: This command shows a tree view of the processes in the
system and their parent-child relationships. This is useful for understanding the
dependencies between processes. However, pstree does not display process
performance information such as CPU or memory usage.
real 0m0.001s
user 0m0.000s
sys 0m0.000s
Explain the difference between the times for real, user and sys:
real: This is the actual time elapsed from the start of command execution to the end
of the command, also known as wall clock time. This time includes the execution time of
other programs and the time the program waits for system resources (e.g., for disk I/O to
complete).
user: This is the time spent by the CPU executing the process in the user state. In
other words, this is the time the CPU spends executing the code of the process.
sys: This is the amount of time the CPU spends executing the process in the kernel
state. This is the time spent by the operating system executing the system calls associated
with the process.
17. Discussion of how you can use these tools to discover and manage a “hung” process
(be sure to define what a “hung” process is):
When a process becomes "hung", it means that it has stalled and is no longer responding to
system or user requests. This can be due to a variety of reasons, such as deadlock, resource
contention, or lack of system resources. To discover and manage hung processes, the
following tools can be utilized:
1. Process Monitor: These tools display all running processes on the system and provide
detailed information about their status and resource usage. Potential hung processes can be
detected by examining processes that have unusually long response times or are no longer
consuming system resources.
2. Task Manager: On Windows systems, Task Manager is a simple but effective tool for
viewing running processes, CPU, memory and disk usage. In the "Processes" tab, you can
find hung processes by looking at the "Status" column, which is usually displayed as "Not
Responding". 3.
3. System Monitoring Tools: These tools help track the use of system resources such as CPU,
memory and disk. By monitoring the use of system resources, it is possible to determine if a
process is consuming a large amount of resources without producing the expected results,
thus indicating possible hangs.
4. Debugger: A debugger is an advanced tool that can be used to analyze the internal state
and behavior of a process. By attaching to a hung process and examining its stack trace,
variable status, and other information, it is possible to gain a deeper understanding of why it
hangs and attempt to resolve the problem.
Once a hung process has been identified, appropriate management actions can be taken,
such as:
Restart: Probably the simplest solution for a hung process is to force it to shut down and
then restart it. This can be done through Task Manager or other process management tools.
Diagnose and Fix: Use tools such as a debugger to further analyze the hung process, identify
the root cause, and attempt to fix the problem. This may involve modifying code, resolving
resource contention issues, or optimizing system configurations.
Resource Management: By optimizing the allocation of system resources, such as adjusting
process priorities, increasing memory or CPU resources, you can prevent similar hangs from
occurring in the future.
In summary, using tools such as process monitors, task managers, system monitoring tools
and debuggers, you can effectively detect and manage hung processes, thus improving
system stability and performance.