Distributed Computing Systems Project 1 – Dumpster Diving Due: Tuesday, March 25 th.

Slides:



Advertisements
Similar presentations
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Advertisements

Utilizing the GDB debugger to analyze programs Background and application.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System Objectives To discuss file-system design tradeoffs, including.
File Management System The way a user or application may access files Programmer does not need to develop file management software You take files for granted.
Permissions Done by: fatma almurr Grade: 10BG. Every file has an inode (information node) that stores information about the file, including when the file.
Linux Commands LINUX COMMANDS.
Distributed Computing Systems Project 2 – Distributed Shell Due: Friday, April 4 th.
The file structure and related utilities CS240 Computer Science II.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Offline File Storage. Module 12 Offline File Storage ♦ Introduction Backup is usually done by first collecting all the data in a single archive file,
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Lesson 11-Locating, Printing, and Archiving User Files.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Linux Operations and Administration
Linux+ Guide to Linux Certification, Second Edition
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
1 Objectives Manage and install new file systems.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
March 2, 2005Wah-kai Ngai1 Installation of Geant4 1st HK Simulation Meeting.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
CS 590 Programming Environments with UNIX. Computer Lab Account Course Homepage
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Project 6 Unix File System. Administrative No Design Review – A design document instead 2-3 pages max No collaboration with peers – Piazza is for clarifications.
1 CSE306 Operating Systems Projects CVS/SSH tutorial.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
LIN Unix Lecture 5 Unix Shell Scripts. LIN Command Coordination ; && || command1 ; command2 Interpretation: Do command 1. Then do command.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Files Tutor: You will need ….
PHP-5- Working with Files and Directories. Reading Files PHP’s file manipulation API is extremely flexible: it lets you read files into a string or into.
Sed. Class Issues vSphere Issues – root only until lab 3.
Lab 8 Overview Apache Web Server. SCRIPTS Linux Tricks.
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
Learning basic Unix command It 325 operating system.
Lesson 6-Using Utilities to Accomplish Complex Tasks.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Today… Strings: –String Methods Demo. Raising Exceptions. os Module Winter 2016CISC101 - Prof. McLeod1.
Introduction to Unix – CS 21
Jonathan Walpole Computer Science Portland State University
Chapter 11 Command-Line Master Class
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Distributed Computing Systems
Linux file system "On a UNIX system, everything is a file;
Lab 1 introduction, debrief
LING 408/508: Computational Techniques for Linguists
Operation System Program 4
Computer Science 2 Hashing
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Winter 2018 CISC101 12/5/2018 CISC101 Reminders
CISC101 Reminders Assn 3 sample solution is posted.
Module 6 Working with Files and Directories
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
Review.
Presentation transcript:

Distributed Computing Systems Project 1 – Dumpster Diving Due: Tuesday, March 25 th

Three Utilities rm – “Remove” files to trash can dv – “Dive” to restore files that were “removed” dump – Permanently remove files

RM Transparently replace /bin/rm – Actually, just earlier in users PATH Moves files to "trash" directory – Specified by user in TRASH environment variable Uses rename() system call, where appropriate – Else copy and then unlink() Same name? Add extension.1,.2,.3... File permissions, including access times, should be preserved – Use the stat(), chmod(), utime() system calls Command line options: – f : force complete remove, do not move to trash directory – r : recurse directories

DV Restore “deleted” files from trash directory – To current working directory ( getcwd() ) File permissions, including access times, should be preserved Feel free to support any command line options that you think are useful – Ex - maybe -a option that lists (or restores) all files with same name, but also with a.1,.2,... extension

DUMP Permanently remove files from trash directory – unlink() and rmdir() Recursive, until whole trash dir is empty

Hints (1 of 4) See get-opt.c for help in parsing command line parametersget-opt.c See stat.c for sample code on how to get status (e.g., permissions) informationstat.c See env.c for sample code on how to (more easily) access environment variablesenv.c See ls.c for sample code on how to do a directory listingls.c See touch.c for sample code on how to set modification timestouch.c Other system calls that may be useful: – chmod() - change (user, group, other) permissions – chown() - change ownerships – link() - add a hard link to a file – unlink() - delete a file – rmdir() - remove a directory – remove() - delete a file or directory – rename() - change the name or location of a file – getcwd() - get current working directory for a process – perror() - print appropriate text-based strings for system call errors – access() - can be used to check for existance of a file – basename() and dirname() - split full path to dir and filename (warning! can modify incoming string so copy first)

Hints (2 of 4) In general … Proceed incrementally, write SMALL pieces of code first and then test When appropriate, place code in separate function to aid readability and testing – e.g., int getExtension(char *name) Do not worry about efficiency nor elegance initially – e.g., static arrays vs. malloc() fine to start Refactor code as appropriate as proceed More than one way to do something – e.g., checking partition can be done using the stat() call, looking at st_dev or by doing the rename() call, looking for EXDEV

Hints (3 of 4) Suggested development steps: 1.Setup program, take in 1+ arg ( argv[1] ) and TRASH with getenv() 2.Move file in current working directory to TRASH on same partition using rename() 3.Add check for same name using access(), adding extension.num 4.Add support for single file in another directory (e.g., /tmp ), using dirname() and basename() 5.Check if file to be moved is on another partition using stat() with st_dev or EXDEV error set by rename() call 6.For files on another partition, write copy function to move across partitions, using link() and unlink() 7.Modify copy to preserve permissions using stat() and utime() 8.Check if file to be moved is a directory using stat() and S_ISDIR() 9.For directories on another partition, write function to iterate through directory using opendir() and readdir(), providing each file name for moving. 10.Parse additional command line arguments (e.g., "-r") using getopt() 11.Modify code to recurse through sub-directories, as appropriate, moving all to TRASH 12.Enable to iterate through all filenames passed in 13.Error check many test cases thoroughly

Hints (4 of 4) Already installed on the Zoo lab Can install in user space

Experiments Measure time to link() + unlink() or rename() – Small operation so repeat and divide Measure throughput (bytes/sec) for copy – Large file Use sync() to be sure flushed and not in RAM Again, put together have per-file cost and per-byte cost. Use to predict time to rm for large dir with many files Measure time for many files (large and small) and compare to predicted

Writeup Design - describe your experiments – Programs/scripts (pseudo-code) – Number of runs – Data recording method – System conditions – Other … Results - depict your results clearly – Tables or graphs – At least mean and standard deviation Analysis - interpret the results – Describe what results mean – How does your prediction match measured? If there is a difference, why do you think there is?

Hand In Source code package – rm.c, dv.c, dump.c – Support files ( *.h ) – Makefile Experimental writeup tar and gzip Use turnin on ccc machines

Grading Support for all command line args (5 points) Proper checking of TRASH env variable (5 points) Support for rename() of single files (5 points) Support for copy and unlink() when needed (10 points) Preserving permissions during copy and unlink() (5 points) Support for directories (5 points) Support for recursive directories (10 points) Support for name collision with.num extension (5 points) Proper working dump (10 points) Proper working dv (10 points) Experiments: – Design (10 points) – Results (10 points) – Analysis (10 points) See rubric on Web page, toorubric