Lab2 TA Notes. Set up for Visual C++ New Workspace Win32 Console Application – This runs from a command line Chose Blank Project Add your.C file Build.

Slides:



Advertisements
Similar presentations
CPSC 441 TUTORIAL – JANUARY 16, 2012 TA: MARYAM ELAHI INTRODUCTION TO C.
Advertisements

Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.c files.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
CS470 Lab 4 TA Notes. Objective Simulate the activities of a producer and consumer – Page 326 Use thread synchronization to solve the producer-consumer.
Operating Systems Course Hebrew University Spring 2007 Signals & User Thread.
Guidelines for working with Microsoft Visual Studio.Net.
CS470 Lab3 TA Notes. Step 1 This is just a simple program that reads in from the command line the time the program should run.
Computer Architecture and Assembly Languages Course’s web site: Teaching Assistant: Or Peri Office Hours: Thursday 37/-108.
Guidelines for working with Microsoft Visual Studio 6.
02/02/2004CSCI 315 Operating Systems Design1 Threads Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
C Programming. C vs C++ C syntax and C++ syntax are the same but... C is not object oriented * There is no string class * There are no stream objects.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
An Introduction to C Programming Geb Thomas. Learning Objectives Learn how to write and compile a C program Learn what C libraries are Understand the.
©2005 GE Fanuc Automation, Inc. All Rights Reserved PACSystems Training Programmer’s Toolkit.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
1 INF160 IS Development Environments AUBG, COS dept Lecture 06 Title: Dev Env: Code::Blocks (Extract from Syllabus) Reference:
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 2 - Welcome Application: Introduction to C++
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Threads A thread (or lightweight process) is a basic unit of CPU.
chap13 Chapter 13 Programming in the Large.
General Programming Introduction to Computing Science and Programming I.
CS 470 Lab 5 Comment your code. Description of Lab5 Create Four projects – Driver – Producer – Filter – Consumer.
C for Java Programmers Tomasz Müldner Copyright:  Addison-Wesley Publishing Company, 2000 Introduction to C Muldner, Chapters 1, 2.
IF-ELSE IF-ELSE STATEMENT SWITCH-CASE STATEMENT Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
1 Using Yacc: Part II. 2 Main() ? How do I activate the parser generated by yacc in the main() –See mglyac.y.
Saves memory and reduces swapping No recompilation on changes A DLL can provide after-market support Programs written in different languages can call the.
Chapter 13 Programming in the Large Dr. Jiung-yao Huang Dept. Comm. Eng. Nat. Chung Cheng Univ. TA: 鄭筱親 陳昱豪.
Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
CS 590 Programming Environments with UNIX. Computer Lab Account Course Homepage
Programming with Visual C++ A short review of the process.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
C Programming in Linux Jacob Chan. C/C++ and Java  Portable  Code written in one system and works in another  But in C, there are some libraries that.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
Homework Assignment #1 J. H. Wang Oct. 13, Homework #1 Chap.1: 1.24 Chap.2: 2.13 Chap.3: 3.5, 3.13* (or 3.14*) Chap.4: 4.6, 4.12* –(*: optional.
Programming with Visual Studio 2005.NET A short review of the process.
Programming with Visual Studio.NET A short review of the process.
Homework Assignment #1 J. H. Wang Oct. 6, 2011.
1 4-Development Environment Development processor  The processor on which we write and debug our programs Usually a PC Target processor  The processor.
Polymorphism, Dynamic Typing, and Dynamic Binding Copyright © 2012 by Yong-Gu Lee
1 SEEM3460 Tutorial Compiling and Debugging C programs.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
Fall 2002 CS 325 Class Notes Page 1 Lecture 25 Today –exec() in Unix –CreateProcess in Windows Announcements.
CS307 Operating Systems Threads Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2011.
Lab00-Getting Started with VC Launch VS 2005 Launch Visual Studio 2005 – Start > All Programs > Microsoft Visual Studio 2005 > Microsoft Visual.
Cs423-cotter1 Windows Operating Environment. cs423-cotter2 Windows Operating Environment 32 bit operating environment – Windows XP Microsoft Visual Studio.net,.net2005,
Makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.c files all linked.
GDT Tips and Tricks. GDT Tips and Tricks Doug Evans GDT 2004 International User Conference – Evolving the Legacy July  Tucson, Arizona GDT Tips.
CS241 Systems Programming Discussion Section Week 2 Original slides by: Stephen Kloder.
2.2 Threads  Process: address space + code execution  There is no law that states that a process cannot have more than one “line” of execution.  Threads:
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
SPiiPlus Training Class
Introduction to Computing Science and Programming I
MT262A Review.
Chapter 6 CS 3370 – C++ Functions.
A bit of C programming Lecture 3 Uli Raich.
CISC105 – General Computer Science
Threads CSSE 332 Operating Systems Rose-Hulman Institute of Technology
A First Book of ANSI C Fourth Edition
Module 1: Getting Started
TCL command in C, a simple example Nguyen Truong – GCS VN Aug 5, 2004
Introduction to System Programming
Lab 1 Introduction to C++.
2.1 Processes process = abstraction of a running program
1. Open Visual Studio 2008.
Lab 1 Introduction to C++.
Our Environment We will exercise on Microsoft Visual C++ v.6
Functions Reasons Concepts Passing arguments to a function
C call R Using .R file in C T. B. Chen in NCTU 2019/5/29.
Presentation transcript:

Lab2 TA Notes

Set up for Visual C++ New Workspace Win32 Console Application – This runs from a command line Chose Blank Project Add your.C file Build project

Visual C++ Settings Change MLD to MTD under Project Options

Visual C++ Settings Change MLD to MTD under Project Options How to do this? Set category: code generation, and Use run-time library: Debug Multithreaded

Visual C++ Settings Add under Object/library modules: libcmtd.lib and

Visual C++ Settings If you add under Object/library /Nodefaultlib:library with substituting word library to the real name of the library, say abc.lib this library will be ignored in linking. Do not forget slash /. The checkbox “Ignore all default libraries” will do the same for all libraries. In typical cases you have no conflicts in libraries and do not need to ignore any libraries. /nodefaultlib:library

Part A Use int main(int argc, char *argv[]) – This will allow you to read in the correct parameters for the program. Error check the parameters sent to the program, use fprintf(stderr, message) to inform the user of an error. If parameters are correct use: – fopen(argv[1], “r”)

Part A continued Use fgets(cmdLine, lineLen, fid) to read in each line and create the process requested. Use CreateProcess( ) to create each process requested. If process is not created give error message. Close handles for all threads and processes.

Part B Setup Visual C++ project same as Part A. Read in parameters and error check as in Part A. Use atoi(argv[1]) to set number of threads to run. Use atoi(argv[2]) to set the amount of time to run.

Part B Continued Calculate the stop time. Show user the starting time. Set variables for stop time. Use a loop to create and run the appropriate number of threads. Use printf( ) to show that each thread is running.

Part B Continued Use while(runFlag) to pole system time to know when to stop threads. Use printf( ) to show when the threads are stopping and also to show they have terminated. Use the function out of the book (p.88) Threadwork to create work for each thread to do.