CS计算机代考程序代写 compiler IOS gui android c++ AI assembler CS246-F20-01-UnixShell

CS246-F20-01-UnixShell

1. Some notes on OSs,
UNIX, and the UNIX shell

CS246 Fall 2020

Prof.
University of Waterloo

Lecture 1.1

• What’s an operating system?

• A brief history of UNIX

• The brave GNU world of the FSF

CS246

Operating system

What’s an operating system (OS)?

Kernel

User interface

CPU Memory Devices

Applications
• An OS provides services to clients,

implemented by the underlying
resources
– It provides an abstraction layer

• It manages execution of apps, time
sharing, communication

• It mediates fair use of shared resources
– CPU, memory, devices

• It prevents misbehaviour
– No deadlock, security violations

• UI can be graphical or command line

System calls

Computers, OSs, and shells

Raw operating system

OS Command Line Intf

OS Graphical User Intf

UNIX, Windows

UNIX shell (e.g., bash), DOS shell

Windows, OS X, IOs, Android

Hardware

Applications

Users

GUI apps, CLI utilities (e.g., GNU),

shells scripts, …

Operating systems (OSs) and shells

• Humans don’t interact with the raw OS directly (e.g., POSIX system calls);
instead, they use:
– the native OS GUI, if they are normal, sensible people, or
– a shell (CLI) when they want to get down and dirty

• Applications can talk to the raw OS, or the OS GUI, or the CLI (shell scripts)

• OS X (MacOS) has two layers: a GUI sits on top of the NIX dialect
– iOs also sits on top of Darwin, but Darwin is inaccessible to normal users in iOS
– Similarly, Android and KindleOS sits on top of Linux
– Windows 95/98/ME did the same thing with DOS but less well
– Windows XP/Vista/7/8/10 were not designed this way (tho current versions of

Windows do have a DOS-like shell, put in for power users; also, bash exists
for Windows 10)

Quick OS history

Mainframes (1950s)

• IBM OS/360
• “Batch operators”

Minicomputers (~1970)

• UNIX (and C)
• PDP-11
• “Live users”

Microcomputers (1980s)

aka “PCs” (desktop/laptop)

• DOS, MS-Windows
• MacOS
• Linux (1991)

Mobile devices (2000s)

• PalmPilot, BlackBerry
• Android, iOS

Today**

• Mobile devices: Android (~85%), iOS (~15%)
• Laptop/desktop PCs: MS-Windows (~82%), OSX (~15%), Linux (~2%)
• Servers: Linux (~67%), Windows (~33%)

**https://en.wikipedia.org/wiki/Usage_share_of_operating_systems

Quick UNIX history

• It’s really hard to overstate how important C/UNIX have been!
– It was a huge step forward, technologically
– “Do one simple thing well”, then combine into pipeline

• The UNIX operating system and the C programming language
were developed together in early 1970s @Bell Labs/AT&T in
, by Thompson/Ritchie/Kernighan/Pike/…

– Early versions of UNIX were written in assembler, later rewritten in C
• Huge portability win!

– UNIX is not an acronym; it’s a lame joke, a play on MULTICS, another
well known OS at the time

– Later, C++ was also developed there by Stroustrup et al.

(d. 2011)

Quick UNIX history

• AT&T license allowed others to create their own
UNIX variants:
– BSD UNIX (late 1970s) at UC-Berkeley, reimplementation with brand

new code and new design ideas
• Free/Net/Open BSD projects later forked from this
• OS X is based on NextStep ( ‘ old company), which is in turn

based on BSD

– Solaris/SunOS (early 1980s, Sun Microsystems, now owned by Oracle)
– AIX, HP-UX, SCO, … other commercial Unices
– Linux (mid-1990s, open source project)

• Android, KindleOS are based on Linux
– BB10 based on QNIX

Brave GNU world

• In 1984, RMS ( . Stallman) quits his day job as a programmer for
the MIT AI lab to found the GNU project and (later) the Free Software
Foundation (FSF)

• His goal is/was to provide a “truly free” UNIX-like operating system
– “Free as in free speech, not free as in free beer”
– GNU’s not UNIX
– The GPL “virus” ensures software remains “free”

• It is hard to overstate the importance that RMS and the FSF have had (and
continue to have) to the world, both technically and techno-politically
– Most of the web runs on technology based on open standards
– Open source software systems include: GNU-Linux/BSD, Firefox/Chrome,

GCC/LLVM, Apache, LibreOffice … and much much more (tho not all are GPL)

Brave GNU world

• The original major components of the GNU system:
– GCC (Gnu Compiler Collection): gcc, g++, …
– glibc (GNU C library)
– GNU coreutilities (ls, cp/rm/mv, chmod, …)
– Some other stuff too (a shell, gdb, …)
– … but NOT an actual OS kernel!

• These are all from-scratch entirely-new-code re-
implementations of existing tools from the (proprietary) UNIX

world of the 1970s/80s

– … with the GPL attached, meaning they are “free” now and in any
future derivative work

Enter Linux … err, GNU/Linux

• In the 1980s, UNIXTM owned by AT&T, who sell it for $$; other commercial
Unices exist too
– By the early 1990s, there are a few quasi-free “UNIX-like” operating systems

(Minix, 386BSD), but it is Linux that really takes off in terms of adoption

– Linux is started by Finnish student Linus Torvalds as a part time project in
1991; many programmers join in “for fun”; v1.0 released in 1994

• Around 1994, I had an i486DX2-66MHz PC that dual booted (Slackware
distro) Linux kernel v0.99pl13/Win3.1; it was very cool J

• What is Linux?
– Technically, it’s just the OS kernel, but that’s not very useful without a shell,

compilers, CL utilities, …

– A Linux distro (e.g., Ubuntu, Debian, ArchLinux) thus also contains a truckload
of “free software” (much of it GNU) so that people can actually use it

– RMS thinks we should use the term GNU/Linux rather than Linux

End

CS246