CS计算机代考程序代写 compiler file system Fortran assembly Unix/Linux

Unix/Linux

CSE 2421

 Developed from 1969-1971 at AT&T Bell Laboratories (Ken
Thompson/Dennis Ritchie/Brian Kernighan/Douglas McIIroy/Joe
Ossanna)

 Written largely in C (some assembly language code as well)
 C was originally developed as a programming language to write the Unix

OS, which was a multi-user, multi-tasking OS.
 Proprietary (requires a license for use)
 AT&T sold Unix to Novell in the early 1990s, which then sold its Unix

business to the Santa Cruz Operation (SCO) in 1995
 UNIX trademark passed to the industry standards consortium The Open

Group, which allows the use of the mark for certified operating systems
compliant with the Single UNIX Specification (SUS). Among these is
Apple’s macOS which is the Unix version with the largest installed base
as of 2014.

https://en.wikipedia.org/wiki/Novell
https://en.wikipedia.org/wiki/Santa_Cruz_Operation
https://en.wikipedia.org/wiki/The_Open_Group
https://en.wikipedia.org/wiki/The_Open_Group
https://en.wikipedia.org/wiki/Single_UNIX_Specification
https://en.wikipedia.org/wiki/Apple_Inc.
https://en.wikipedia.org/wiki/MacOS

 “Modular design”: The OS provides a collection of simple tools
that each implement a limited, well-defined function.

 More complex functionality is provided by combining the
simple tools.

 A unified file system is the main means of communication; for
example, devices (e.g., disk drives) are treated as files.

 First “portable” operating system

 Developed in 1991 by Linus Torvalds, a graduate student in Computer
Science at the University of Helsinki.

 Linux is a Unix “clone,” we can say, because it does not use Unix code
(which is proprietary, and therefore could not be freely distributed), but
it provides the same functionality and features as Unix generally, and
follows the Unix OS philosophy.

 Open source, so it is available in versions without cost (There are also
versions which are licensed for a fee, often with support, as well as the
OS itself)

 Various “distributions,” which are all broadly similar, but also exhibit
various differences (If you would like to get a Linux distribution, ask me,
and I’ll be glad to point you to some!).

 It is worth your time and effort to learn as much as you can about Linux,
because you are likely to encounter Linux/Unix in the work world.

 “Unix is used by 68.2% of all the websites whose operating system we
know..”

 Linux is used by 59.3% of all the websites whose operating system we
know. (This 59.3% is a part of the 68.2% aggregate above.)

http://w3techs.com/technologies/details/os-unix/all/all

Linux also runs on 96-98% of the top 500 supercomputers!

Has anyone used a Raspberry Pi???

http://w3techs.com/technologies/details/os-unix/all/all
http://w3techs.com/technologies/details/os-unix/all/all
http://w3techs.com/technologies/details/os-unix/all/all

http://www.diffen.com/difference/Linux_vs_Unix

Fully expect a question or two from this article on
the mid-term.

http://www.diffen.com/difference/Linux_vs_Unix

 If you log on to stdlinux in a lab, or remotely, you will be in
your home directory, with a Linux prompt (the % character):

[kirby.249@fl1 ~]$

 Let’s make a new directory for the lab 1 assignment, using the
mkdir command:

[kirby.249@fl1 ~]$ mkdir cse2421

[kirby.249@fl1 ~]$ cd cse2421

[kirby.249@fl1 cse2421]$ mkdir lab1

 Now, let’s change to the directory we just created, using the
cd command:

[kirby.249@fl1 cse2421]$ cd lab1

 Now, let’s invoke a text editor which we want to open in a new
window (the & after the command does that), in order to enter
our source code in a file called hello.c (the & causes the text
editor to open in a separate window):

[kirby.249@fl1 lab1]$ gedit hello.c &

 If you use & at the end of the command to invoke a text editor, and another window
does not open with a text editor (after a reasonable wait), you may not have an X
server installed on your machine.

 This should only happen if you have a Mac, though it does not always happen on a
Mac.

 Apple included an X server in some versions of OS X, but not in others.

 If you need an X server, you can download and install one for free; see the
information on downloading a free X server for Mac at this link:

https://cse.osu.edu/computing-services/resources/remote-access

 I’ve also seen times when stuff that worked stopped working in the middle of a
session. Use the standard Microsoft trick of rebooting. (Save everything first.)

https://cse.osu.edu/computing-services/resources/remote-access
https://cse.osu.edu/computing-services/resources/remote-access
https://cse.osu.edu/computing-services/resources/remote-access
https://cse.osu.edu/computing-services/resources/remote-access
https://cse.osu.edu/computing-services/resources/remote-access

 By convention, C source code files in a Unix/Linux
environment have a .c “extension” (It isn’t really an extension
in Unix/Linux, and the OS does not need it; the source code
file is just a text file, and the OS can identify it as a text file
without the .c).

 Here is the source code we want to put in the file:

#include

/* Author: put your name here */

int main(void)

{

char string1[] = “The quick fox jumped over the brown dog.”;

int i;

int max = 1;

for (i = 0; i ddd –manual

File: ddd.info, Node: Top, Next: Summary, Up: (dir)

Debugging with DDD

******************

DDD is a graphical front-end for GDB and other command-line debuggers.

This is the First Edition of `Debugging with DDD’, 8 Feb, 2009, for

DDD Version 3.3.12.

The first part of this master menu lists the major nodes in this Info

document, including the label and command indices. The rest of the menu

lists all the lower level nodes in the document.

* Menu:

* Summary:: Summary of DDD.

* Sample Session:: A sample DDD session.

* Invocation:: Getting in and out of DDD.

* Windows:: The DDD windows, menus, and buttons.

* Navigating:: Moving through the source code.

* Stopping:: Making your program stop at specific locations.

* Running:: Running programs under DDD.

 http://www.gnu.org/software/ddd/manual/

The DDD manual is available in the following formats:
•formatted in HTML (633K characters, 3.5M pictures) entirely on one web
page.
•formatted as a PDF file (1.5M characters).
•formatted as a PostScript file (859K characters gzipped).

A plain text version of the DDD manual is compiled within DDD; it can be viewed
• from within DDD using `Help -> DDD Manual’ or
• by invoking DDD as `ddd –manual’.
Texinfo sources as well as Info files are included in the DDD source
distribution.

http://www.gnu.org/software/ddd/manual/
http://www.gnu.org/software/ddd/manual/

Execute gdb or ddd in the directory that contains all of your source code files and your
executable. This might be $HOME/cse2421/lab1 

Everyone knows that debugging is twice as hard as writing a program in the first place. So if
you’re as clever as you can be when you write it, how will you ever debug it? – Brian Kernighan,
“The Elements of Programming Style”, 2nd edition, chapter 2

The most effective debugging tool is still careful thought, coupled with judiciously placed print
statements. – Brian Kernighan, “Unix for Beginners” (1979)

 Once you can compile and run the program successfully

and have performed the debugger commands specified,
now you can submit it.

 Programs must be submitted to Carmen in a zip file
 The instructions for creating a.zip file will be included

in the lab1 description document.
 The graders will pull them from Carmen and test them

based on the grading criteria.
 It is a good idea for you to download your submission

from Carmen and build it the way the graders will
directly after you submit it

 Any warnings or errors when compiling? If so, 0 points
awarded

 Does the program execute correctly with the example output?
With any other valid inputs?

 Does it execute correctly at or near boundaries?

 Did it follow other constraints in the lab description?

 Did you follow all of the other lab description instructions?

 Take a look at the other Linux commands that are shown in
the document called LabUnixCommands.pdf on Piazza.

 The commands in the pdf should be all that you’ll need for
this course.

 Nonetheless, if you need to know how to do something that
you haven’t done before, you can do an internet search to find
the relevant commands.