0% found this document useful (0 votes)
74 views32 pages

Session 2 Introduction To Unix 2023

This document provides an outline and overview of a university lecture on the UNIX operating system. The 3-page document covers definitions of operating systems and UNIX, a brief history of UNIX, the main functions and users of UNIX systems, and how to open and close a UNIX session. It aims to introduce first year computer science students to the UNIX system.

Uploaded by

louissamad5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views32 pages

Session 2 Introduction To Unix 2023

This document provides an outline and overview of a university lecture on the UNIX operating system. The 3-page document covers definitions of operating systems and UNIX, a brief history of UNIX, the main functions and users of UNIX systems, and how to open and close a UNIX session. It aims to introduce first year computer science students to the UNIX system.

Uploaded by

louissamad5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Tlemcen University

Computer Science Department


1st Year Engineer

"Introduction to operating system 1"

Session 2: Overview of the UNIX system

Academic year: 2023-2024

1st Yaar Engineer Computer science Tlemcen University


Outline

 Introduction
 Definition and functions of an operating system
 History of the Unix (Linux) operating system
Presentation of the Unix system
 Unix users
 The main functions
 Structure of the Unix system
 How Linux works
 The Shell
Opening and closing a session
 Opening a session
 Creating/changing a password
 Closing a session
1st Year Engineer Computer Science Tlemcen University Octobre 2023 2
Introduction

 What is an operating system?


 An operating system (OS) is a set of programs that manage the
hardware resources of a computer and make these resources
available to the user, so that the user can use the computer effectively.
 An operating system is a meta-program, a program that manages the
computer's hardware resources and interacts with users to run other
programs.
 Examples of operating systems:
Windows, Mac OS, Unix, OS/2, BeOS, AmigaOS, Plan 9, etc.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 3


 An operating system can be defined :
 By component
 Divide it down into major components to get an overall idea of the
system: memory, CPU and peripherals
 By functions (what can it be used for?)

1st Year Engineer Computer Science Tlemcen University Octobre 2023 4


OS objectives
 Resource management ( efficiency)
 OS makes the most of the machine's resources
 Making the best use of resources for maximum performance
 There are two types of resources:
 Hardware: central memory, CPU and peripherals
 Software :
– File: a collection of data on a storage medium, grouped together according
to certain mechanisms.
– Process: a running program,
Virtual machine (easy to use)
 OS aims to satisfy the user by providing a user-friendly environment
for operating the machine.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 5


OS: Machine /User

• Users

• Compiler Assembler Text editor

• Operating System

• Hardware

• Compiler Assembler Text editor

• Users

1st Year Engineer Computer Science Tlemcen University Octobre 2023 6


Services provided by the operating system
 An operating system must provide the following services:
 A command interface for the user
 Support for program creation
 File management
 Management of programs and applications
 An interrupt service (software and hardware)
 Input/output management and associated hardware.
 Services for networks and associated hardware.
 Measurement of computer statistics and performance.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 7


History of UNIX

 The origins of Unix date back to the late 1960s at Bell Labs.
 This laboratory, in collaboration with MIT, was developing an
operating system called "Multics".
 In 1969, Ken Thompson, one of the staff at Bell Labs, developed a
game called "Space Travel" on Multics, and then on other operating
systems.
 K. Thompson wrote, in collaboration with Dennis Ritchie, a file
management system, a few basic utilities such as cp and rm, and a
shell.
 In 1970, Brian Kernighan, another collaborator with Thompson,
suggested the name "UNIX", a pun on "Multics".

1st Year Engineer Computer Science Tlemcen University Octobre 2023 8


 The rise of Unix is very closely linked to the C language.
 Originally, the first Unix was written in assembler, then K. Thompson
created a new "B" language.
 In 1971, D. Ritchie in turn wrote a new "C" language, based on the B
language.
 In 1973, almost all of Unix was rewritten in C (95% was in C).
– This made Unix the first system in the world to be written in a portable
language (not in assembler).
 In 1974, Linux was distributed to universities (Berkeley and Columbia). It
consisted of :
– a simple, modular file system,
– a unified interface to peripherals via the file system,
– Multitasking
– and a flexible, interchangeable command interpreter.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 9


 1979-1984:
the first commercial steps In 1979, with version 7, Linux developed
commercially.

 1984-1993 ....: standardization


In 1984, System V.2 was adopted as the standard,

In 1985 AT&T published SVID (System V Interface Definition), which


defined the application interface of the V.2 system and not its
implementation,
In 1986, the V.3 system introduced shared libraries and RFS (Remote File
Sharing),
In 1993, X/Open launched COSE (Common Open Software Environment).
These were agreements between manufacturers to develop applications in a
common environment.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 10


 1991- ...: Linux
 LINUX is a free implementation of the POSIX specifications with System V
(AT&T) and BSD (Berkeley) extensions,
 In 1991, Linus B. Torvalds (Helsinki) used MINIX (Minix is an operating
system, a Unix clone, based on a microkernel created by Professor Andrew
Stuart Tanenbaum for educational purposes).
 August 1991: 1st version of LINUX 0.01. This is a rewrite of MINIX, with the
addition of new functions and the distribution of sources on the Internet,
– This version made it possible to run a number of essential GNU (free software)
applications such as the gcc compiler and the bash shell,
– Linus decided to put the source code under the GPL licence: everyone could then
participate in the development of Linux under legal conditions.
 1991-94: the anarchic development of Linux prevented it from becoming a
competitive system.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 11


 Its weak point is its file system, inherited from Minix.
 With the integration of the BSD file system (ext2fs: Second Extended Filesystem)
into Linux,
– This made Linux a reliable system and became a standard.
 Linux became a complete UNIX system compatible with other UNIX systems,
offering more professional-quality services.
 1995
 With the advent of the Internet, Linux was able to expand among developers and
also in the operating systems market.
 The emergence and development of private companies such as RedHat contributed
to the evolution of Linux.
 The distributions (Red Hat, Fedora, Ubuntu, Debian, etc.) became increasingly
user-friendly and easy to install, and professional services were set up to facilitate
the implementation of Linux in businesses.
 1996
 RedHat is voted the best OS by InfoWorld.
 Start of the KDE project: development of user-friendly projects for the general
public begins.
1st Year Engineer Computer Science Tlemcen University Octobre 2023 12
Presentation of the UNIX system

 UNIX users
 There are two types of person on a UNIX system:
 the UNIX user
 This person uses the system to produce something; the UNIX system is a
tool for them.
 This category includes programmers, database users, etc.
 UNIX system administrator
 This category of people is responsible for installing, configuring and
running the UNIX system.
 On a UNIX system, UNIX users have limited permissions,
 Certain commands are forbidden to them and they do not have access to
certain parts of the system.
 System administrators, on the other hand, have full rights over the system.
 The number of administrators is generally limited on a UNIX system
(called ROOT or superuser).
1st Year Engineer Computer Science Tlemcen University Octobre 2023 13
 A UNIX user belongs to one or more groups.
 Groups are used to bring users together in order to assign them common
rights.
 The main group is the user's initial group.

 The user may belong to secondary groups.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 14


The main functions of UNIX system
 UNIX is an operating system whose main tasks are as follows:
 Resource sharing
 UNIX ensures that all the computer's resources (CPU, memory, etc.) are
shared equally between all the processes.
 For example, if an application such as a database is launched and this
application is time-consuming, another application can be launched in the
same way.
– You end up with two processes running at the same time;
– The OS is responsible for ensuring that the two processes can use resources
equitably and that the second process launched does not wait for the first to
finish before launching itself.
 The ability to run several processes or tasks at the same time, in parallel, is
called multitasking.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 15


 Interface with hardware
 UNIX does not allow any process to directly access a hardware resource (hard
disk, USB, keyboard, ....).
 These resources are accessed via special files (applications).
– For example, to write to a USB key in the USB port, all you have to do is write to
the special file in the USB port. Similarly, to read from a hard disk, you read the
special file on the hard disk.
 Memory management
 There are two types of memory: volatile memory and static memory,
– When the computer is switched off and on again, all the data in volatile memory
disappears, while the data in static memory is always present.
– Volatile memory is found in RAM (Random Access Memory), static memory in a
hard disk, CD or USB stick.
 In the UNIX vocabulary, memory management refers to the management of
random access memory (RAM).

1st Year Engineer Computer Science Tlemcen University Octobre 2023 16


 Every program that runs (process) needs memory to store the data that it
manipulates.
– However, a computer generally has a limited and non-extendable amount of
memory.
• UNIX must therefore ensure that memory is shared between all processes,
• Any one process must not monopolize all the memory, otherwise the other processes
would no longer be able to function (putting them into a state of starvation).

 In UNIX, memory is seen as a hardware resource. UNIX must therefore check


that no process accesses memory directly.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 17


 File management
 UNIX provides the tools needed to store data and retrieve it quickly and easily.

 It also provides the tools to view all the files in a simple way.

 These files are located on storage media such as hard disks.

 UNIX provides a file protection mechanism.


– Given that several users can work at the same time on the same machine, this is
the concept of multi-users.
– Each user of the system has their own files, and UNIX gives them the means to
protect their files, and to grant other users the permession to access their files or
not.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 18


The benefits of Unix
 Portability
 Software is portable when it can run on different machines.
 Multi-user
 The Unix system allows several users to access system resources.
 Multi-tasking
 Unix allows users to perform more than one task at a time.
 File system
 Allows a hierarchical structure
 Modular programs
 The system is made up of utilities, each designed for a specific task.
 User interface
 It is essentially command-oriented

1st Year Engineer Computer Science Tlemcen University Octobre 2023 19


Unix structure

 The structure of Unix is made up of four concentric layers:


 The central kernel: contains the basic process and memory
management functions. It is a time-sharing allocation automaton.
 The complete kernel: contains the input/output interface drivers.
 Shell: is the command interpreter through which the user interacts
with Unix.
 Tools and applications: the set of programs and utilities that have
been developed to enhance the system.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 20


Cont’

• Utilities

• Shell
• Kernel

• Hardware

1st Year Engineer Computer Science Tlemcen University Octobre 2023 21


Cont’
 The operating system is a set of programs grouped together in what
is known as a kernel.
 Processes cannot access hardware resources directly,
 In fact, processes use the kernel to access them, using a set of
commands called UNIX "system calls".
 These system calls control two main components of the kernel,
 The process manager,
– Its role is to ensure that processes run and access memory fairly, and it is also
known as the scheduler.
– It interacts with the file subsystem through a specific set of system calls such
as: open, close, read, write...

1st Year Engineer Computer Science Tlemcen University Octobre 2023 22


 the file management system.
– Its role is to manage the file system, particularly in terms of access rights, file
space allocation and free space recovery.
These two kernel components access the hardware directly.

 The kernel manages the basic tasks of the system:


 System initialization,
 Resource management,
 Process management,
 File management,
 I/O management

1st Year Engineer Computer Science Tlemcen University Octobre 2023 23


 The Shell
 To operate the machine, the user has access to software or a utility that
allows commands to be entered directly.
 This utility is called the Shell.

 Its role is to interpret user commands before transmitting them to the


kernel,
This is why it is also called the command interpreter.

 There are several types of Shell, differing in syntax and the range of
commands.
 The most common is the Bourne Shell (sh), but there is also the C-Shell
(csh), which is similar to the C programming language, the Korn Shell, the
Posix Shell and, under Linux, the Bourne Again Shell (bash).

1st Year Engineer Computer Science Tlemcen University Octobre 2023 24


• Reading a command
• (default from keyboard)

• Analysis of the command

• Yes • Write a message to the


• Error console

• No
• Run the code corresponding to
the internal command

1st Year Engineer Computer Science Tlemcen University Octobre 2023 25


The Unix kernel
 Kernel structure
 The file subsystem
A file occupies space (for space management)
 The process subsystem
A process has a lifetime

1st Year Engineer Computer Science Tlemcen University Octobre 2023 26


• User programs

• User level

• System call interface

•Inter-process
communication
• Subsystem filesystem

• Scheduler
• control subsystem

• Buffer
• Memory manager
Character Block

• Hardware control

• Hardware
• Hardware level
1st Year Engineer Computer Science Tlemcen University Octobre 2023 27
File management
 In Unix, a file is seen as a logical resource, not a physical one.
 It is a set of blocks of data that are scattered on the disk and can be
recovered using assembly mechanisms.
 File types in Unix :
 Ordinary files Standard files (text, executable, ....)
 Catalogue files directories (folders)
 Special files Peripherals as data sources or used as outputs

1st Year Engineer Computer Science Tlemcen University Octobre 2023 28


Login and logout
 Logging in
 Before attempting a connection, you must first ensure that you have an
account on the machine,
a user account characterized by a name or login and an associated
password.
 When you switch on the machine, it asks you to enter the login and
password and then you can open a terminal from which you type your
commands,
 Under Linux you would have as follows: [login@localhost login]$.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 29


 Changing the password
 Once the user is logged in, they can change their password using the
"passwd" or "yppasswd" command,
 Some UNIX systems require passwords with at least 6 characters,
including 1 or 2 non-alphabetical characters.
 If you have forgotten your password, you must contact the system
administrator (root) who is the only person authorized to unlock it.
>passwd Old passwd :******
Setting password for user : Mohamed
New password :******
Reenter password :******

1st Year Engineer Computer Science Tlemcen University Octobre 2023 30


 Closing a session
 To log out or close the session
If you are in a non-graphical environment, simply type the following
commands at the prompt:
gnome-session-quit (if you are in your session) or
sudo pkill -KILL -u username-of-the-session.
You will then be presented with the login prompt, and another user will be
able to use the machine.
You should take care to log out when you are no longer using the system,
for security reasons, but also to free up the workstation.
In a graphical environment, the commands exit, logout and Ctrl-D have
the same effect. These commands are used to exit the terminal.

1st Year Engineer Computer Science Tlemcen University Octobre 2023 31


 Creating a session
 Only
root users or users with sudo privileges can use the adduser
command to create new user accounts.
sudo adduser username
A password will then be requested for this new user
 This session will be created in the /home directory

1st Year Engineer Computer Science Tlemcen University Octobre 2023 32

You might also like