Skip to main content

Task Management

Chapter 14 – Task Management

 

If you've used Windows for any length of time, then you've probably encountered the Task Manager – the graphical utility that lets you observe system performance, see which applications and processes are running on your system, and manually kill processes that become unreliable or freeze up. There are several commands that let you perform many of the Task Manager's functions from the command line. In this chapter, we'll show you how to manage processes from the command prompt. Using the commands in this chapter, you'll be able to list running processes on your computer, and terminate ones that become troublesome. 

 

WHAT IS A PROCESS?

 

In Windows, a “process” doesn't refer to the specific procedure you use to do something, or a standardized method for carrying out a task. Rather, a process is defined as the active instance of a computer program. For example, if you ran the Firefox web browser, Firefox would be a running process. Once you exit Firefox and close your browsing session, the process would exit and disappear. 

A process can also be a background program running on your computer, either a background program you installed yourself or a component of Windows. If you launch Task Manager (or use the commands described later in this chapter) you will see dozens of processes. Most of them will be background components of Windows itself, like the print spooler or the networking services. 

Generally, Windows handles its processes, whether applications or built-in Windows services, pretty well, and you don’t need to think about them. But like anything else, there can be problems. Sometimes a process will freeze up and refuse to quit, and you will need to forcibly terminate it. Additionally, some processes can seize so much of your computer’s available memory or CPU power that your system slows to a crawl and becomes nonresponsive. If that happens, you’ll need to find out which process is hogging the resources and terminate it. 

In the next section, we’ll show you how to list currently running processes on your computer. 

 

LISTING RUNNING PROCESSES

 

To view the running processes on your computer, use this command:

TASKLIST

This will immediately list every running process on your Windows computer. This will probably scroll off the screen, so you might want to pipe the output to the more command to let you view the output one screen at a time:

TASKLIST | MORE

By default, tasklist lists five different pieces of information about the processes running on your system. The first, Image Name, is basically a friendly name that allows you to find the process quickly in a list. The second, PID, stands for Process Identifier. Windows assigns a Process Identifier number to every process on your system, and the PID turns up in several log files. 

The third piece of information, Session Name, identifies whether or not a process is a Services session or a Console session. Basically, a Services process is one launched by Windows to run in the background, while a Console process was launched by the user logged into the computer. On a Windows Server system, you can also see RDP under Session Name – that means a user logged onto the server via Remote Desktop Services launched the process. 

The fourth piece of information is Session Number, listed as Session#. On a client Windows system, you’ll generally only see two numbers – 0 for processes launched by Windows, and 2 for processes launched by the logged-in user. On a Windows Server system running Remote Desktop, you will often see more numbers. 

The final piece of information, Mem Usage, simply lists the amount of memory a specific process is using.

You can get even more information from the tasklist command if you use it with the /v option:

TASKLIST /V

When used with the /v command, TASKLIST provides four additional columns of information. The first, Status, displays what the process is currently doing. Most of the time, this will say Running, but if a process has frozen up, it could say Not Responding. Processes launched by Windows will say Unknown, since Windows has control of them. 

The second piece of information is User Name, which lists the user that launched the process. Usually, this will be the user currently logged into the system. If you are using this command on a Remote Desktop Services system, this can help you track down which user launched which process, which is very useful if a specific process is hogging all the system resources.

The third piece of additional information is CPU Time, which shows how much CPU time each process has used. As with Mem Usage, this can help you track down a process that is using too many system resources. The final piece of information is Window Title. If a process has also opened a window on the desktop, the title of the window is listed here. If you have an errant application that refuses to close and you do not know the name of its process, you can help use the title of its window to find its process here.

 

TERMINATING PROCESSES

 

Generally, when processes work, you don’t have to think about them. If you are going to the trouble of listing processes, that probably means one or more processes have malfunctioned and you need to forcibly shut them down. Listing processes allows you to find which processes you need to terminate. To terminate a process from the Command Prompt, use this command:

TASKKILL

By itself, taskkill only spits on an error message. To make proper use of it, you need to specify either the image name or the PID of the process you wish to terminate. For instance, if you wanted to terminate a process with an image name of application.exe, you would use TASKKILL with the /IM switch to specify the image name:

TASKKILL /IM APPLICATION.EXE

This would kill the APPLICATION.EXE process immediately.

You can also use the /PID switch to specify TASKKILL to terminate a process with a specific PID. To return to our previous example, if APPLICATION.EXE has a PID of 1234, you can use this command to terminate it by PID:

TASKKILL /PID 1234

Additionally, the TASKKILL command offers two additional switches you can use with either the /PID switch or the /IM switch. First, the /F switch forcibly terminates the process, which is useful if you have a recalcitrant process that simply refuses to terminate. Second, the /T switch also terminates any child processes that the process launch. So, if you wanted to terminate a process with a PID of 1954, while also forcing it to terminate and terminating any child processes, the command would look like this:

TASKKILL /T /F /PID 1954

The process would then be terminated, along with any child processes. 

 

Comments

Popular posts from this blog

File attributes and NTFS permissions

Chapter 5 - File attributes and NTFS permissions   We’ve already mentioned both file attributes and NTFS permissions throughout this book. In this chapter we’ll take a closer look at file attributes, and discuss how to view and change attributes from the command line. We’ll also examine NTFS permissions, which are considerably more powerful than file attributes, and discuss how to view and alter them as well.   WHAT ARE FILE ATTRIBUTES?   “File attributes” are basically pieces of metadata that contain additional information about the file. In Windows, files generally have their names, their types (defined by the file’s extension), and their timestamps. (Certain kinds of files, such as MP3 music files, have additional kinds of metadata, such as the album and artist name.) With file attributes, however, there are four additional pieces of information that you can add to a file.  These four pieces of information are: -Archive,...

Methods used for the calculation of areas in Surveying

Methods used for the calculation of areas in Surveying: Simpson’s rule Trapezoidal rule Graphical rule Simpson’s Rule Statement It states that, sum of first and last ordinates has to be done. Add twice the sum of remaining odd ordinates and four times the sum of remaining even ordinates. Multiply to this total sum by 1/3 rd of the common distance between the ordinates which gives the required area. Where O 1 , O 2 , O 3 , …. O n are the lengths of the ordinates x = common distance n = number of divisions Note: This rule is applicable only if ordinates are odd, i.e. even number of divisions. If the number of ordinates are even, the area of last division maybe calculated separated and added to the result obtained by applying Simpson’s rule to two remaining ordinates. Even if first or last ordinate happens to be zero, they are not to be omitted from Simpson’s rule. The following offsets are taken from a chain line to an irregular boundary toward...

About creating partition

About creating partition To create partition is actually to partition hard drive. Only after you creating partition(s) on a disk, can you make use of the disk to save all kinds of data. All physical parameter of a disk are set when you create partition(s) on it, including MBR (Main Boot Record) and the destination for storing boot record backup. For other information later needed for the management of file system and other operating systems, it will be achieved by later advanced format. What are the advantages of creating partitions? Generally speaking, creating more than one partition enables you to have operating system separate from data, deploy multi-boot setups, and keep frequently used programs and data near each other. Therefore, you can manage your computer with ease. If there is only one partition (namely C drive) on disk: When recovering the system, the whole c disk (the system disk) will be formatted. If all data are saved in c disk, they will all be wiped a...