(4)Why Should You Create a Backup of Your Files

Total Page:16

File Type:pdf, Size:1020Kb

(4)Why Should You Create a Backup of Your Files

Lab 12 Process Management & Standby Mode

Topics:  Processes & Process Management  Tasklist & taskkill commands  Running programs & CPU Usage  Windows 7 - Standby Mode

Processes: Windows, like most modern operating system, is multitasking, which means that it can execute many programs simultaneously. A program that is currently executing is called a process. A Windows system consists of several dozen active processes at any time. Some of these processes are system processes that perform important “behind the scenes” tasks and some are user processes corresponding to programs like Internet Explorer or MSWord.

Process states: Ready: in queue, Ready to execute, waiting on the CPU to become free Running : Actually using the CPU Blocked/Waiting : Not ready to execute, but waiting on some event to occur before it will be ready again (e.g. maybe data from a file)

Process state diagram:

Questions: (a) A process changes states throughout its lifecycle, what do the transitions 1-4 above represent.

1. ……………………………………………………………………………………………

2. ……………………………………………………………………………………………

3. ……………………………………………………………………………………………

4. ……………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 1 of 11 (b) On the diagram above, draw i) Where a new process enters and ii) Where a terminated process leaves.

What is the difference between a program and a process? Give an example to explain your answer?

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

Log into your VMware account to carry out this lab sheet. Don’t do it on the local machine.

Process Management:

Task 1. Starting the Task Manager GUI in Windows 7.

Use Ctrl + Alt + Insert to start the Task Manager in the virtual PC. How do you start it normally?

………………………………………………………………………………………………

What is the Task Manager in Windows 7 used for? Write down a brief description in your own words below.

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

Start Microsoft Word, Notepad and Internet Explorer. In the Task Manager view the applications that are currently running on the machine.

Task 2. What information is given about the processes running on the computer?

………………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 2 of 11 To view more information on each process click the Processes tab. Then click the View option from the menu and click Select Columns. What options are available now and what do they mean?

………………………………………………………………………………………………

………………………………………………………………………………………………

Task 3. Kill the Microsoft Word process.

What happens to any word document you had not saved when you kill Microsoft Word, would it be lost?

………………………………………………………………………………………………

Task 4. Approximately how many processes are running on the computer? Why are there so many processes when you only have a few user applications running on the machine?

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

How many processes are actually executing on one CPU at a given instant in time?

………………………………………………………………………………………………

Is it necessary to change the priority of a process? ………………………………………………………………………………………………

………………………………………………………………………………………………

Is it possible to change the priority of a process? How? ………………………………………………………………………………………………

………………………………………………………………………………………………

Task 5. The performance tab shows you several graphs, all updated in real time. Used to monitor performance of the system. What use is this info to you?

………………………………………………………………………………………………

………………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 3 of 11 Task 6. Tasklist and Taskkill Commands

Change to the command prompt.

Type in the command tasklist What does this command display?

………………………………………………………………………………………………

Tasklist command:

TASKLIST [/SVC] [/V] [/FI filter]

Description:

This command line tool displays a list of application(s) and associate task(s)/process(es) currently running on either a local or remote system.

What details are displayed about each process?

………………………………………………………………………………………………

What does PID stand for?…………………………………………………………………..

What does the /v switch for tasklist command do?………………………………………………

Type in tasklist /svc to get a table relating Process Name, PID, and Services, very useful to know the relationship between a process and the services that are running on a system. What is a service?

………………………………………………………………………………………………

………………………………………………………………………………………………

Task 7. Filtering Processes

Processes can be filtered using ProcessName (image name), PID, MemUsage, Status, Username and WindowTitle. For Example, type command: tasklist /fi “status eq not responding” is used to find processes that are not responding.

Lab 11: Process Control & Shutdowns Page 4 of 11 See tasklist /? or help tasklist

(Useful Information: username = nt authority\system)

Note: You need to run the command prompt in administrator mode in order to see the system processes.

Write the command to list all running non system processes.

………………………………………………………………………………………………

Task 8. Investigate the taskkill command [taskkill /?]

TASKKILL { [/FI filter] [/PID processid | /IM imagename] }

Description: This command line tool can be used to end one or more processes. Processes can be killed by the process id or image name.

Find out how to use it to kill an instance of notepad. Write the command.

………………………………………………………………………………………………

Can it kill processes with a specific PID?…………………………………………….……......

Write the command to forcefully shut down all the processes that are not responding.

………………………………………………………………………………………………

Task 9. Running programs & CPU Usage

(a) We are going to use batch files to execute some small programs.

To write a for loop in Java you would do so as follows:

for (int i=0; i<10; i++)

{ // do stuff }

Lab 11: Process Control & Shutdowns Page 5 of 11 This can be done in a batch file also. Download the batch file called nums.bat from Blackboard. It is in the following folder: LabPracticals\Files

@echo off

for /l %%i in (1, 1, 1000000) do ( echo This is iteration %%i )

:end

(b) Run the batch program nums.bat

The program prints the numbers 1 to 1000000 and then finishes. (Press CTRL+C at any point during its execution to stop it).

(c) Run the program and examine the CPU usage graph for this program in the task mana ger. [The program you are looking for is called cmd.exe. You will find it in the processes tab on the tas k manager].

You can also sort by any of the fields at the top e.g. CPU usage by clicking on the column labeled CPU.

(d) Download the second batch file called nums2.bat from Blackboard.

@echo off

for /l %%i in (1, 1, 1000000) do ( echo This is iteration %%i if %%i==9000 call :getname

) GOTO end :getname set /p name=What is your name? echo Hello %name% pause

:end echo That's it!

Lab 11: Process Control & Shutdowns Page 6 of 11 (e) Run program and examine the CPU usage (Performance tab) for this program in the ta sk manager. What happens to the CPU usage figure when the user is asked “What is your name” ?

………………………………………………………………………………………………

………………………………………………………………………………………………

What state is the process in when the user is asked “What is your name” ? Explain why it is in this state.

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

(f) Two programs running:

Open up two command prompts and run nums.bat in each one.

Go into the task manager and sort by the column labeled CPU. Scroll until you see cmd.exe – you should see two of these – as you have two command pro mpts.

What do you notice about the CPU figure for each?

………………………………………………………………………………………………

………………………………………………………………………………………………

Is the CPU single or dual core on the VM machine?

………………………………………………………………………………………………

How did you find out this information?

………………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 7 of 11 Windows 7 - Standby Mode

Shutting down Windows 7 is a simple process. Before shutting down your PC, you should first save and close all files you have open and close all programs.

Task 10. Using the Standby options

Desktop computers can use a lot of electricity, if you leave your PC on all day and use it for only a few hours.

You can put your computer into Standby mode. What is standby mode?

Standby mode: ………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

What happens to any files you have open on the computer if the electricity goes out?

………………………………………………………………………………………………

Task 11. Look at the power setting in your computer. Is your computer in standby mode and after how long? …………………………………

Change the length of time? …………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 8 of 11 Revison Questions (Taken from past exam papers)

(a) What is the maximum number of processes that can run on a CPU at any one time and explain why?

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

(b) What is a blocked process in reference to process management? Explain in your own words ONLY using an example.

……………………………………………………………………………………………………….

……………………………………………………………………………………………………….

……………………………………………………………………………………………………….

………………………………………………………………………………………………

………………………………………………………………………………………………

(c)

1.If a process is not using the CPU, what state(s) is it in? …………………………………..

2.If a process is in the ready state, what will be its next state? ……………………………...

3.If a process is in the blocked state, what will be its next state? …………………………...

4.If a process is in the running state, what will be its next state? ………………………......

(d) Write the command in the command prompt which will list all the NON system processes which are using less than 3 MB of memory?

………………………………………………………………………………………………

……………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 9 of 11 (e) Write the command you would use to forcefully shut down a process with a PID of 1234 using the taskkill command in the command prompt?

………………………………………………………………………………………………

(f) How do you set up your computer to go into standby mode after 30 minutes of inactivity? State clearly what menus and programs you access to set this up on your computer.

………………………………………………………………………………………………

………………………………………………………………………………………………

(g)

Investigate how to set up your computer so that it will go into Hibernation Mode. How did you do this?

………………………………………………………………………………………………

How much disk space does your machine require to hibernate? ………………………………

Why does it require that amount? …………………………………………………………

………………………………………………………………………………………………

What is the name of the hibernation file on disk? …………………………………

What is the difference between the two?

Standby mode: ………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

Hibernation mode: ………………………………………………………………………………………………

………………………………………………………………………………………………

………………………………………………………………………………………………

Lab 11: Process Control & Shutdowns Page 10 of 11 Lab 11: Process Control & Shutdowns Page 11 of 11

Recommended publications