Program 5 - Processes and Signals (100 points)



Similar documents
Please note that a username and password will be made available upon request. These are necessary to transfer files.

Introduction to the use of the environment of Microsoft Visual Studio 2008

Implementing and testing tftp

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

CS 557- Project 1 A P2P File Sharing Network

Flight Workflow User's Guide. Release

CPE453 Laboratory Assignment #2 The CPE453 Monitor

Lecture 25 Systems Programming Process Control

Setting up PostgreSQL

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3

Managing Mailbox Space and Personal Folders

Configuring and Integrating MAPI

Capture Pro Software FTP Server System Output

Linko Software Express Edition Typical Installation Guide

Microsoft Office 365 online archive features and FAQs

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes

Quark Publishing Platform Upgrade Paths

SimbaEngine SDK 9.4. Build a C++ ODBC Driver for SQL-Based Data Sources in 5 Days. Last Revised: October Simba Technologies Inc.

CPSC 2800 Linux Hands-on Lab #7 on Linux Utilities. Project 7-1

Release Note RM Unify CSV Extraction Tool

How to test and debug an ASP.NET application

CS355 Hw 3. Extended Shell with Job Control

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

Forming a P2P System In order to form a P2P system, the 'central-server' should be created by the following command.

WINDOWS PROCESSES AND SERVICES

Moving the TRITON Reporting Databases

Lepide Exchange Recovery Manager

Developing, Deploying, and Debugging Applications on Windows Embedded Standard 7

CS10110 Introduction to personal computer equipment

MS SQL Express installation and usage with PHMI projects

Project 5 Twitter Analyzer Due: Fri :59:59 pm

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

How to Compile, Link, and Execute C or C++ Codes Using Microsoft Visual C++

How to Install Multiple Monitoring Agents on a Microsoft Operating System. Version StoneGate Firewall/VPN 2.6 and SMC 3.2

Process definition Concurrency Process status Process attributes PROCESES 1.3

Code Estimation Tools Directions for a Services Engagement

Computer Lab Software Fault-tolerance: Task Process Pairs

2010 Outlook Web App Client Overview

Getting Started Guide

Upgrade Guide BES12. Version 12.1

How to Configure a Stress Test Project for Microsoft Office SharePoint Server 2007 using Visual Studio Team Suite 2008.

Sage ERP Accpac U.S. Payroll Versions 5.5S, 5.6O and 6.0J Tax Update for June 30, 2012

Microsoft Windows PowerShell v2 For Administrators

RTI Database Integration Service. Getting Started Guide

Visual Studio.NET Database Projects

TIBCO ActiveMatrix BusinessWorks Plug-in for TIBCO Managed File Transfer Software Installation

Lesson 0 - Introduction to Playstation 3 programming

Setting Up Database Security with Access 97

Contents 1 Overview 2 Steps to run an Excel Add-In Setup: 3 Add-Ins 4 LOGIN 5 SEND SMS 5.1 Send Text or Flash Sms 5.2 Select Range 5.

Unicenter NSM Integration for Remedy (v 1.0.5)

Snapshot Reports for 800xA User Guide

MICROSTRATEGY 9.3 Supplement Files Setup Transaction Services for Dashboard and App Developers

1 Posix API vs Windows API

AssetWise Performance Management. APM Remote Upgrade Guide

Learn how to create web enabled (browser) forms in InfoPath 2013 and publish them in SharePoint InfoPath 2013 Web Enabled (Browser) forms

Version Control with Subversion

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++)

CT Bus Clock Fallback for Linux Operating Systems

Setting Up ALERE with Client/Server Data

Introduction to Operating Systems

Outlook . User Guide IS TRAINING CENTER. 833 Chestnut St, Suite 600. Philadelphia, PA

Programming with the Dev C++ IDE

Settle-to-File Credit Card Driver for 3700 POS

Tutorial 5: Developing Java applications

StruxureWare Power Monitoring 7.0.1

The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig

This presentation explains how to monitor memory consumption of DataStage processes during run time.

Pocket ESA Network Server Installation

Partek Flow Installation Guide

IHS Emergency Department Dashboard

Enterprise Content Management System Monitor 5.1 Agent Debugging Guide Revision CENIT AG Author: Stefan Bettighofer

dotdefender v5.12 for Apache Installation Guide Applicure Web Application Firewall Applicure Technologies Ltd. 1 of 11 support@applicure.

PaperStream Connect. Setup Guide. Version Copyright Fujitsu

SMART Sync Windows operating systems. System administrator s guide

Outlook Data File navigate to the PST file that you want to open, select it and choose OK. The file will now appear as a folder in Outlook.

Netbeans IDE Tutorial for using the Weka API

CA Nimsoft Monitor. Probe Guide for E2E Application Response Monitoring. e2e_appmon v2.2 series

Law School Computing Services User Memo

Deploying Microsoft Operations Manager with the BIG-IP system and icontrol

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

Administration Guide. . All right reserved. For more information about Specops Deploy and other Specops products, visit

AFN-StudentBillingTuitionManagementGuide

Java Language Tools COPYRIGHTED MATERIAL. Part 1. In this part...

PostgreSQL on Windows

1 of 10 1/31/2014 4:08 PM

The online environment

Bitrix Site Manager ASP.NET. Installation Guide

CDD user guide. PsN Revised

End User Setup and Handling

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

Protecting SQL Server Databases Software Pursuits, Inc.

How to Copy Photos to a CD Using Microsoft Windows XP or Microsoft Windows Vista

How to Configure the Workflow Service and Design the Workflow Process Templates

Word 2010: Mail Merge to with Attachments

Importing Contacts to Outlook

Monitoring Replication

Rational Rational ClearQuest

Transcription:

Program 5 - Processes and Signals (100 points) COMPSCI 253: Intro to Systems Programming 1 Objectives Using system calls to create and manage processes under Linux and Microsoft Windows Using Visual Studio on Microsoft Windows 2 Introduction In this assignment, you will develop a simple systems program that allows you to experiment with various system calls on Linux and Microsoft Windows. 3 Specification 3.1 Linux (50 points) We will develop the program in two phases. Waiting for Godot! Write a program that creates as many processes as the number of CPUs on your system (using the fork system call). Each created process generates 300 million random integers using the random() function. Set the seed on each process using srandom() with the process id (obtained using getpid()). We will use the random numbers for something inane: count how many numbers were within the range 90..110. After generating 300 million random numbers, each process sleeps for 5 seconds. Each created process repeats this calculation followed by the sleep ad nauseum. Watch the load using the system monitor. The number of CPUs can be determined via the following system call: sysconf( SC NPROCESSORS CONF) Struck by lightning while waiting for Godot! Take the same program and add an alarm interval as a command line argument, where godot is the name of the program executable: godot <alarm interval> The program now sets up a signal handler and an alarm. When alarm arrives, it kills all the running child processes using the kill() system call. Also add a loop at the end of the main program that uses the waitpid() system call to determine what signal caused the child process to terminate. Please print the full information on the signal using the strsignal call (check its man page). Note that the alarm timer isn t inherited by the child processes. 1

3.2 Sample Output (on Linux) Here is the expected output (on Linux): [amit@kohinoor amit]: godot Usage: godot <alarm interval> [amit@kohinoor amit]: godot 20 original process, pid = 10127 0th child, pid = 10128 1th child, pid = 10129 2th child, pid = 10130 3th child, pid = 10131 Process 10129 finished round 0 count = 5 Process 10128 finished round 0 count = 2 Process 10130 finished round 0 count = 3 Process 10131 finished round 0 count = 3 Process 10129 finished round 1 count = 5 Process 10128 finished round 1 count = 3 Process 10130 finished round 1 count = 3 Process 10131 finished round 1 count = 7 Process 10129 finished round 2 count = 9 Process 10128 finished round 2 count = 3 Process 10130 finished round 2 count = 4 Process 10131 finished round 2 count = 11 Received alarm signal! pid = 10128 0th child killed with signal 9 (Killed) pid = 10129 1th child killed with signal 9 (Killed) pid = 10130 2th child killed with signal 9 (Killed) pid = 10131 3th child killed with signal 9 (Killed) [amit@kohinoor amit]: 3.3 MS Windows API (50 points) Rewrite the same program using MS Windows API. Note that all the examples for the MS Windows API are in the folder: lab/ms-windows/files-processes Make sure you update them through svn if you have them already checked out. Create a new Visual Studio project named godot. To find out the number of CPUs on your system, use the following call: GetSystemInfo(...) The MS Windows API doesn t have the random() and srandom() functions. Instead use the rand() and srand() functions. 2

Windows doesn t have a kill() system call like in Linux. So we will use the TerminateProcess() call to kill the processes and set an exit value. We can use GetExitCodeProcess() to get the exit code in the main process. We will arbitrarily use the exit code of 9 to denote termination of a child process by the parent. Note that the MS Windows API doesn t have an alarm signal. However, they do have a call CreateTimerQueueTimer(...) to create and use a timer. Check the example alarm-test.c and the example timeout.c in the folder lab/ms-windows/files-processes/ to see an example of using an alarm under the Windows API. Notes Make sure to follow the instructions in the lecture notes on setting the Visual Studio project. If you load one of the provided examples in Visual Studio and it doesn t compile or has warnings, then you did not set up the project properties correctly! The most common problem is to not have character setting be Multi-Byte (instead of the default Unicode). Note that if you use the Add Existing Item option to add a source file, then Visual Studio doesn t actually copy the file to the project. To copy the file to a project, copy the file using the File Explorer into the Visual Studio project. Back in Visual Studio, select Project Show All Files. Then go to the Solution Explorer pane, right click on the file you have added and choose Include File in Project option. Make sure to remove the large database file in the Visual Studio solution. This file is in your Visual Studio project folder and has an extension.sdf. How to stop Visual Studio from putting the large database file (with extension.sdf) inside your project. Go to Tools Options Text Editor C/C++ Advanced In the Fallback Location set Always Use Fallback Location to True and Do Not Warn If Fallback Location Used to True. In Fallback Location you can either put a path like C: Temp or if you leave it blank then Visual Studio will use the temporary directory in your AppData folder. 3

3.4 Sample Output on MS Windows Here is the expected output on MS Windows. Note that we are using the rand() random number generator on Windows, which generates numbers in the range [0... 32767]. Hence the counts are higher than using random() under Linux, which generates numbers in a much larger range. The following output was captured from running the executable from powershell. PS Z:\Shared\Visual Studio\godot\Debug>.\godot.exe Usage: godot <alarm interval> PS Z:\Shared\Visual Studio\godot\Debug>.\godot.exe 20 Number of processors: 4 Created 0th child, pid = 4188 Created 1th child, pid = 14656 Created 2th child, pid = 14568 Created 3th child, pid = 13944 Process 4188 finished round 0 count = 174215 Process 14656 finished round 0 count = 174990 Process 14568 finished round 0 count = 173415 Process 13944 finished round 0 count = 173786 Process 14656 finished round 1 count = 349279 Process 4188 finished round 1 count = 349549 Process 14568 finished round 1 count = 347307 Process 13944 finished round 1 count = 347448 Received alarm! pid = 4188 0th child killed with exit code 9 pid = 14656 1th child killed with exit code 9 pid = 14568 2th child killed with exit code 9 pid = 13944 3th child killed with exit code 9 PS Z:\Shared\Visual Studio\godot\Debug> 4 Documentation Include a unified README file at the top-level of your submission that describes the results and observations for the Linux and MS Windows version. 5 Submitting the Assignment Your executable should be called godot with the alarm interval as a command line argument. You should also have a Makefile that compiles and links your Linux program. The Makefile should be at the top-level of your submission. Prepare your directory for submission by removing all executables and object files. You should only have the source code, README file, Makefiles files before submitting. For the MS Windows version, please submit the full solution folder from Visual Studio after running clean on the project (without a rebuild). The executable name should still be godot 4

with the same command line argument. Put the Windows part in a separate subfolder named ms-windows. Make sure to remove the large database file with extension.sdf from the Visual Studio project before submitting! Put all the required files for the assignment in a directory (files are listed below): Makefile godot.c README ms-windows/ Change to that directory and submit using the command appropriate for your section from the table below. section submit command 1 submit spanter cs253 p5 2 submit marissa cs253-2 p5 3 submit amit cs253 p5 4 submit marissa cs253-4 p5 5