1 / 22

LINUX System : Lecture 2 (English-Only Lecture)

LINUX System : Lecture 2 (English-Only Lecture). Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University. Acknowledgement : (i) wikipedia.org , (ii) http://www.doc.ic.ac.uk/~wjk/UnixIntro. Operating Systems.

karenfisher
Download Presentation

LINUX System : Lecture 2 (English-Only Lecture)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LINUX System : Lecture 2(English-Only Lecture) Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement : (i) wikipedia.org , (ii) http://www.doc.ic.ac.uk/~wjk/UnixIntro

  2. Operating Systems • OS acts as an intermediary between user and HW • Resource Manager • Allocates and manages system resources (CPU, Memory, Disks, Networks, … ) • Efficient and fair use of the resources • Interface • OS allows users and application programs to access system resources • Controls the execution of user programs accurately • Efficiently, Fairly, Safely(Accurately), Abstractly

  3. Computer System Structure • HW – provides basic computing resources • CPU, memory, disk, … • OS Kernel • direct control of underlying HW • System call • Programming interface to the services provided by the OS • The one program running at all times on the computer is the kernel. Everything else is either a system program (shipped with OS) or an application program • Application programs • Define the ways in which the system resources are used to solve user problems • executed thru shell/GUI. • Ex) word processor, video games, etc

  4. Operating Systems • Functionality • Process Management • CPU scheduling : batch vs time-sharing • Memory Management • Memory allocation : determine what is in memory when? • Virtual memory : a technique that gives an application program the impression that it has large contiguous working memory, while in fact it is physically fragmented and may even overflow on to disk storage. • Disk and file system • Device driver : interface for communicating with HW devices • Networking : supports network protocols. (ex) TCP/IP • Security : authentication (login), authorization (file permission), … • UI : GUI (Graphical User Interface), CLI (Command Line Interface) • OS comes with application programs that provide an interface for managing OS.

  5. Storage Hierarchy • Register, Cache, Main memory, Secondary Storage (disks), Magnetic tapes • Why hierarchical structure? • Speed • Cost • Volatility • Caching • Copying information into faster storage system. • Faster storage checked first to determine if information is there • Cache<->main memory, main memory<->disk • Important principle, performed at many levels in computer

  6. OS Structures • Multiprogramming • a technique used to utilize maximum CPU time by running multiple programs simultanously • Single user cannot keep CPU and I/O devices busy at all times. • Multiprogramming organizes jobs (code and data) so CPU always has one to execute • One job is selected and run via job scheduler • When a running job has to wait for I/O, OS switches to another job • Multitasking (time-sharing) • CPU switches jobs so frequently that users can interact with each job while it is running. • Creates interactive computing • Response time can be controlled • If processes don’t fit in memory, swapping moves them in and out to run

  7. Operating Systems • MS Windows • Most popular on desktop computers • Gaining popularity in servers. • UNIX/LINUX • Most popular in server environments • LINUX are gaining popularity on desktop PC.

  8. UNIX System • has been popular for more than two decades • Portability • Written mostly in C + a few in assembly language • Kernel size is small • Multi-user, multi-tasking environment • Stability • Powerful networking capabilities • Free, open source code(LINUX) Suitable for using as a server

  9. UNIX History • Created by Ken Thompson et al. ( a researcher at AT&T Bell Lab) • UNICS(1969) (shortened to UNIX later) : first version • Released Fifth version of UNIX • kernel was rewritten in C, which was a big step forwards in terms of system portability (1973) • LINUX • Developed by Linus Torvalds, a finnish undergrad student, in 1991 • Free open source UNIX OS for PC • Open source code nature means any one can add features and correct deficiencies. • Turned in to collaboration of hundreds of volunteer developers around the world. • Several different distributions (e.g. Redhat, Debian, … etc) • Distribution comprises a prepackaged kernel, system utilities, GUI, application programs

  10. LINUX • Kernel • Device driver support for various HW device • Advanced processor and memory management • Support different types of file system • Shells / GUI : two forms of command input • Textual command line shells (e.g. C shell, … ) • Graphical user interface (e.g. GNOME window manager) • System utilities • Virtually every UNIX system utilities were ported to LINUX • Include daemons • server program running as a background process • Application programs • Come with standard application programs • e.g. vi, emacs, xv, gcc/g++, xfig, latex, …

  11. Cygwin

  12. Login, Password • When connecting a UNIX system (locally or remotely) login : will password : • After successful login, you will get shell prompt where you can give command input. $ • To logout, type exit • In GUI, it is trivial to login/logout • Password change $ passwd • Avoid dictionary words

  13. Understanding /etc/passwd • /etc/passwd • Stores essential information required during login i.e. user account information • It contains one entry per line for each user (or user account) of the system. All fields are separated by a colon (:) symbol. Total seven fields as follows • Username(1), password(2)-x means passwords are stored in /etc/shadow, user ID(3), group ID(4), user ID info(5), home directory(6), command/shell(7)

  14. UNIX File System • Three types of UNIX files • Ordinary files • Contain text, data, program • Cannot contain other files or directories • Filename is not divided into name and extension officially • Up to 256 characters long • Directory file • A file that has a list of other files and directories • Special file : I/O device • Devices : for easy access to HW device, a device is dealt with as a file. e.g.) READ/WRITE for printer, network socket, … • Links • A pointer to another file • hard link : direct pointer ex) $ln filename linkname • soft(symbolic) link : indirect pointer ex) $ln –s filename linkname

  15. Directory in UNIX < hierarchical tree structures >

  16. Directory • Contains a list of files or directories and their properties/locations • tree structure • a parent may have many childs, and a child can have only one parent • Path • absolute path : /home/bongbong/a.txt • relative path : usr/bin/xv • Directory • Home directory, eg) cd ~bongbong • Current directory : . , parent directory : ..

  17. File Access • Example : /usr/bin/xv • Read root(/) directory • Find the location of “usr” from “/” • Read “usr” and find the location of “bin” • Read “bin” and find the location of “xv”

  18. Commands for Files and Directories • pwd : prints [current] working directory • cd : change directory • mkdir , rmdir : create/remove a directory • cp, mv, rm : copy, move, remove • chmod : change permission of a file • cat , more : prints text files • man : manual for a command • ls : list files

  19. File properties • ls –l • type is a single character which is either 'd' (directory), '-' (ordinary file), 'l' (symbolic link), 'b' (block-oriented device) or 'c' (character-oriented device). • permissions is a set of characters describing access rights. There are 9 permission characters, describing 3 access types given to 3 user categories. The three access types are read ('r'), write ('w') and execute ('x'), and the three users categories are the user who owns the file, users in the group that the file belongs to and other users (the general public). An 'r', 'w' or 'x' character means the corresponding permission is present; a '-' means it is absent. • links refers to the number of filesystem links pointing to the file/directory owner is usually the user who created the file or directory. • group denotes a collection of users who are allowed to access the file according to the group access rights specified in the permissions field. • sizeis the length of a file, or the number of bytes used by the operating system to store the list of files in a directory. • dateis the date when the file or directory was last modified (written to). The -u option display the time when the file was last accessed (read). • nameis the name of the file or directory.

  20. File Permission

  21. Link • a pointer to another file • Hard link to a file is indistinguishable from the file itself ex) $ln filename linkname • Soft link (symbolic link) provides indirect pointer or shortcut to a file • ex) $ln –s filename linkname $ ln -s hello.txt bye.txt $ ls -l bye.txt lrwxrwxrwx   1 will finance 13 bye.txt -> hello.txt $ • Soft link may point to a non-existing file

  22. Wildcard : Specifying multiple files • UNIX shell processes this • ‘?’ matches any one character • ‘*’ matches any of zero or more characters • Characters enclosed in square brackets ('[' and ']') will match any filename that has one of those characters in that position • A list of comma separated strings enclosed in curly braces ("{" and "}") will be expanded as a Cartesian product with the surrounding characters • he* matches any filename beginning with 'he'. • [m-z]*[a-l] matches any filename that begins with a letter from 'm' to 'z' and ends in a letter from 'a' to 'l'. • {/usr,}{/bin,/lib}/file expands to /usr/bin/file /usr/lib/file /bin/file and /lib/file.

More Related