0% found this document useful (0 votes)
61 views43 pages

The Cloud OS

The document discusses key aspects of operating systems and how they relate to artificial intelligence. It explains that an AI operating system would involve training AI models to interact with and personalize a system's calls in a way that is tailored to individual users. A good cloud operating system is described as being fast, lightweight, providing containers/VMs, and having automated deployment/updates. The growth of Linux is attributed to cloud spending, adoption by large companies, internet of things, security concerns, and cost sensitivity. Popular cloud operating systems and the Docker ecosystem are also summarized.
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)
61 views43 pages

The Cloud OS

The document discusses key aspects of operating systems and how they relate to artificial intelligence. It explains that an AI operating system would involve training AI models to interact with and personalize a system's calls in a way that is tailored to individual users. A good cloud operating system is described as being fast, lightweight, providing containers/VMs, and having automated deployment/updates. The growth of Linux is attributed to cloud spending, adoption by large companies, internet of things, security concerns, and cost sensitivity. Popular cloud operating systems and the Docker ecosystem are also summarized.
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/ 43

The Cloud Operating System

Some slides have been adopted from IBM Linux Study Guide under IBM Academic Relationship program

Enterprise Software Overview MSSE


1
CMPE272 Fall 2019
AI and the Operating System
Setting the Context

A Must read:

https://towardsdatascience.com/ai-and-the-operating-system-
4282edd3a930

Marriage between AI and OS


https://becominghuman.ai/the-concept-of-i-ai-and-the-operating-
system-part-2-672752f1fa3

Enterprise Software Overview MSSE


2
CMPE272 Fall 2019
What makes an AI OS?
• An OS is a huge list of programmed system calls. Bring AI to
interact with such system calls and you have an AI OS.
• An OS is somewhat a deterministic system, AI needs to be
trained so AI can help personalize the OS
• An OS is designed for general purpose work suited for
multiple personas and there is NO such thing called AGI or
Artificial General Intelligence exist today

Enterprise Software Overview MSSE


3
CMPE272 Fall 2019
What makes a good cloud operating
system?
• Fast boot up time
• Consumes less resources
• Provides containers or virtual machines
• Auto deployment and update
• Runs workload with excellent performance
• Good networking support
• Good storage support (block, network, endurance)
• Secure

Enterprise Software Overview MSSE


4
CMPE272 Fall 2019
Why Linux adoption is growing?
According to IDC, these 5 factors are fueling the growth:
• Cloud spending
• Large player adoption
– https://azure.microsoft.com/en-us/services/azure-sphere/
– https://clearlinux.org/
– https://www.clearos.com/
– https://www.redhat.com/en
• Internet of Things (IoT)
– Gartner claims that there were 8.4 billion connected things in 2017
with expectations to rise to 20.4 billion in 2020. Nearly all of these
“connected things” will be running a Linux kernel.
• Security concerns
• Cost sensitivity

Enterprise Software Overview MSSE


5
CMPE272 Fall 2019
Choices of cloud OS
• CoreOS - A lightweight Linux operating system designed for
clustered deployments providing automation, security, and
scalability for your most critical applications (In RedHat now)
• Project Atomic – Deploy and manage your docker containers
http://www.projectatomic.io/ (also part of RedHat)
• OSv
– Lockless single memory space collaborativehttp://osv.io/ memory
management (http://osv.io/ )
• CentOS https://www.centos.org/
• Ubuntu for cloud http://www.ubuntu.com/cloud

Enterprise Software Overview MSSE


6
CMPE272 Fall 2019
Docker Ecosystem
• Distributed runtime with REST API for Linux containers (LXC)
• Linux containers virtualize the host kernel
• Thinner virtualization than hypervisors
• Completely integrated with Linux
• Docker container inherits the performance of host kernel

https://resources.sei.cmu.edu/asset_files/Presentation/2017_017_001_4
97378.pdf

https://docker-curriculum.com/

Enterprise Software Overview MSSE


7
CMPE272 Fall 2019
Serverless Computing
Serverless computing is a cloud-computing execution model in which the
cloud provider runs the server, and dynamically manages the allocation of
machine resources.
The difference between traditional cloud computing and serverless is that
you, the customer who requires the computing, doesn’t pay for underutilized
resources.
– Instead of spinning up a server in AWS for example, you’re just spinning
up some code execution time.
– The serverless computing service takes your functions as input, performs
logic, returns your output, and then shuts down. You are only billed for the
resources used during the execution of those functions.
Major vendors initiative:
• https://cloud.google.com/functions/
• https://cloud.ibm.com/functions/
• https://azure.microsoft.com/en-us/services/functions/
• https://cloud.google.com/knative/
• https://aws.amazon.com/serverless/
Enterprise Software Overview MSSE
8
CMPE272 Fall 2019
Top Trends in Virtualization
– Multi-cloud deployment and management of workload
– Elastic AI infrastructure (GPU virtualization)
– Virtual Remote attached GPUs FPGAs etc..
– Improving Data Center efficiency using AI

• https://bitfusion.io/
• https://docs.google.com/a/google.com/viewer?url=www.google.com/
about/datacenters/efficiency/internal/assets/machine-learning-
applicationsfor-datacenter-optimization-finalv2.pdf

Enterprise Software Overview MSSE


9
CMPE272 Fall 2019
The operating system
• Abstracts the real hardware of the system and
presents the system’s users and its applications
with a virtual machine.
• Handles I/O to and from attached hardware
devices
• Manages file I/O
• Supports file systems
• Manages all other programs running on the
computer
– Determines which applications should run
– In what order
– Determines the time slice(CPU time is
divided into “slices”) of a processes
• Manages sharing of the internal memory
among multiple applications

Enterprise Software Overview MSSE


10
CMPE272 Fall 2019
Detailed version of OS

vi tar ls

User mode

Kernel mode

Operating System

Memory Disk Drive Graphics Printer

Enterprise Software Overview MSSE


11
CMPE272 Fall 2019
Linux Kernel Subsystem

User Level Programs and Libraries

User

Kernel
System Call Interface

Virtual file system Memory Process


manager manager manager Network Services

VFS
VFSDriver
VFSDriver
Driver TCP/IP Drivers

Hard disk driver CDROM Driver


Ethernet Card driver
kernel

Disk Drive Disk Drive Disk Drive hardware


Enterprise Software Overview MSSE
12
CMPE272 Fall 2019
Kernel Subsystem
• Normal programs execute in user mode
• Kernel programs execute in kernel mode (privileged mode)
• Kernel takes requests from applications running in user
mode and perform requested operations on the hardware.
• Linux kernel consists of several important parts: process
management, memory management, hardware device
drivers, file system drivers, network management and
various other bits and pieces.

• Optional Reading:
• http://tldp.org/HOWTO/KernelAnalysis-HOWTO-3.html

Enterprise Software Overview MSSE


13
CMPE272 Fall 2019
Kernel Types
• Monolithic kernel
– All OS related code are stuffed into a single module
– Available as a single file
– Functions fast
• Micro kernel
– OS components are isolated and run in their own address space
– Device drivers, programs and system services run outside kernel
memory space. Only a few functions such as process scheduling, and
interprocess communication are included in the microkernel
– Supports modularity

Enterprise Software Overview MSSE


14
CMPE272 Fall 2019
Kernel Types

Enterprise Software Overview MSSE


15
CMPE272 Fall 2019
Kernel mode (privileged mode)
• Kernel mode also referred as system mode
• Designed for restriction/protection from unauthorized user
application program
• When the CPU is in kernel mode, it is assumed to be
executing “trusted” software and thus it can execute any
instructions and reference any memory address.

• Thus all user mode software must request use of the kernel
by means of system calls in order to perform privileged
instructions, such as process creations or input/output
operations

• Ex: device drivers

Enterprise Software Overview MSSE


16
CMPE272 Fall 2019
User mode (un-privileged mode)
• User mode is normal mode for operating programs
– Web browsers, calculator
• Code running in user mode must delegate to system APIs to
access hardware or memories
• Most of the code running on your computer will run in user
mode

Question: why did we come up with two different modes?

Enterprise Software Overview MSSE


17
CMPE272 Fall 2019
Short history of Linux

Enterprise Software Overview MSSE


18
CMPE272 Fall 2019
Short history of Linux (2)

Enterprise Software Overview MSSE


19
CMPE272 Fall 2019
Short history of Linux (3)

Enterprise Software Overview MSSE


20
CMPE272 Fall 2019
Linux source in browser

http://lxr.free-electrons.com/

Enterprise Software Overview MSSE


21
CMPE272 Fall 2019
Linux Boot Process
1. CPU Initialization
2. Execute single instruction and jump to BIOS (ROM)
3. BIOS finds boot device and fetches MBR(on the hard
disk/CDROM/or any registered devices)
4. MBR points to LILO(Linux Loader/boot manager, similar to
windows boot.ini)
5. LILO loads compressed Linux kernel
6. Compressed kernel is decompressed and loaded
7. Root file system mounted
8. Init(mother of all processes) process started
9. Rest is all forking of new processes (kernel remains
uncompressed in protected mode)

Enterprise Software Overview MSSE


22
CMPE272 Fall 2019
Linux Boot Process

Enterprise Software Overview MSSE


23
CMPE272 Fall 2019
Linux Process

Enterprise Software Overview MSSE


24
CMPE272 Fall 2019
Starting and Stopping of a process

Enterprise Software Overview MSSE


25
CMPE272 Fall 2019
Process Summary

• A program is an executable stored somewhere(perhaps on


hard disk) in a computer. This program owns no resources
and can not do anything until it gets executed.
• Once executed, a process is created which does own
resources.
• Inside of this running process, threads can be used to do
extra work for the process.
• Example:
– A database interface application can use one thread to create a
connection to the database, another thread to display the data in the UI
and third thread to play music in the background(for fun)

Enterprise Software Overview MSSE


26
CMPE272 Fall 2019
The Life cycle of a Process
• Linux process is created using fork() and terminated either
using exit() or by receiving a signal. Implementation is in
kernel/fork.c and kernel/exit.c respectively.
• Processes communicate with each other (IPC) and with the
kernel
• Linux supports IPCs such as signals and pipes
• Processes are protected from one another – kernel gives
them separate address space.
• New processes (specially child threads) are created by
cloning a currently running process using clone()

• Optional readings:
• http://linux.die.net/man/2/clone
• http://oreilly.com/catalog/linuxkernel/chapter/ch10.html

Enterprise Software Overview MSSE


27
CMPE272 Fall 2019
Managing process priorities

Enterprise Software Overview MSSE


28
CMPE272 Fall 2019
Time slice
Processes on a Linux system are scheduled according to priority:
• When the CPU is free to run a process, it looks through the process
table for a process with the lowest priority number.
• This process then gets a timeslice on the CPU.
• The priority number of a process is continuously changed. Basically
three factors influence this:
1. After a process has had a certain amount of CPU time, its priority
number is increased, meaning that next time the CPU becomes
available, the process is less likely to be first in the list.
2. After a process has been idle (not using CPU time) for a while
(either because it is waiting for something to happen, or because
other processes are keeping the CPU busy), the priority number
is decreased.
3. The priority number can never become lower than the nice value
that was set for that process. This scheme results in a usage
pattern where every process with the same nice value gets an
equal amount of CPU time. Processes with a higher nice value get
less CPU time than processes with a low nice value.
Enterprise Software Overview MSSE
29
CMPE272 Fall 2019
Linux Memory Management
• Makes system appear to have more RAM than it really has
• Shares RAM between competing processes as they need it
• Hard drive space used to extend physical memory
• Virtual memory provides:
– Large address spaces (swapper, pagefile etc..)
– Protection (process has its own virtual address space)
– Memory mapping (image and data files are mapped into virtual address
space)
– Fair physical memory allocation
– Shared virtual memory
– Copy on write
– A nice book on Memory Management in Linux(Optional
Reading)
http://www.ecsl.cs.sunysb.edu/elibrary/linux/mm/mm.pdf

Enterprise Software Overview MSSE


30
CMPE272 Fall 2019
Copy on write
• Optimization strategy used by OS
• Every process uses the single shared copy of the same data until it is modified, at
that time true private copy is created
• True benefit is that if a caller never modifies the data no private copy ever need to
be created
• Linux OS uses demand paging that uses copy-on-write technique
– A process acquires its page table from its parent process (during a folrk() with
the entries mark as read only
– If the process tries to write to that memory space and page is copy-on-write
page then it is copied and marked as read-write

Enterprise Software Overview MSSE


31
CMPE272 Fall 2019
Paging vs. Swapping
• Linux uses a technique • Linux uses a Least
called demand paging Recently Used(LRU)
• Memory pages of a technique to swap a
process are brought into page
RAM only when a • More frequently
process attempts to use accessed pages are
them younger
• Kernel alters the • Less frequently
process’s page table accessed pages are
marking the virtual older
areas as existing but not • Old pages are good
in memory candidates for swapping

Enterprise Software Overview MSSE


32
CMPE272 Fall 2019
File systems

• A file is a:
– Collection of data
– A stream of characters or byte stream
• No structure is imposed on a file by the operating system
• Linux supports many file system
• Ext2 is Linux’s default file system and is widely used
• Implemented using a VFS(Virtual File system) layer
• Kernel sends a file system calls to VFS
• VFS redirects to FS
• Designated file system uses its own code and buffer cache
functions to request I/O on physical devices

Enterprise Software Overview MSSE


33
CMPE272 Fall 2019
File Types

Enterprise Software Overview MSSE


34
CMPE272 Fall 2019
Displaying Binary files

Enterprise Software Overview MSSE


35
CMPE272 Fall 2019
Virtual File systems

Enterprise Software Overview MSSE


36
CMPE272 Fall 2019
Interrupts
• A signal sent to the operating system from hardware
– Hardware device (interrupt routines)
– Software (system calls)
• Used to allow the hardware to communicate with OS
• Interrupt handling details are hardware and architecture
specific
• Code for handling interrupts is located in:
– /usr/src/linux/arch/i386/kernel/irq.c
– /usr/src/linux/include/asm/irq.h
– /usr/src/linux/include/linux/irq.h

Enterprise Software Overview MSSE


37
CMPE272 Fall 2019
IPC Mechanisms
• Classic IPC mechanisms
– Signals (i.e.. SIGTERM)
– Pipes
• Basic I/O between 2 processes
• Cane be Named or Unnamed

• Sockets
• System V IPC mechanism
– Shared memory
– Semaphores
• Locking & Waiting
– Message Queues
• http://tldp.org/LDP/lpg/node7.html

Enterprise Software Overview MSSE


38
CMPE272 Fall 2019
IPC: Signals
• Signals are most common IPC
• 0-31 standard signals and 32-64 real-time configurable
• Used to send asynchronous events to one or more processes
• Signals are like software interrupt and unidirectional
• Signals are used to exit processes, kill programs etc.
• Signal numbers are defined in the /usr/include/bits/signum.h
file, and the source file is /usr/src/linux/kernel/signal.c.
• Signals are:
– Delivered in system mode
– Received in user mode
• Received signals can be:
– Accepted
– Ignored
– Blocked
– Handled (at later time)

Enterprise Software Overview MSSE


39
CMPE272 Fall 2019
Kill Signals

Enterprise Software Overview MSSE


40
CMPE272 Fall 2019
IPC: Unnamed vs. Named Pipes
• Unnamed pipes are • Named pipes are also
used since early Unix called as FIFO
days (1973)
• Have a file name
• Facilitates bidirectional
communication between • Can be used by any
two processes process as long as they
• Processes must reside have access
on same machine • Entities in a file system
• Processes must have (not temporary object)
same ancestor for pipes • Command: mkfifo
to work
• Uses same data structure
• Unnamed pipes are and operations as used
temporary
by unnamed pipes
• Command: pipe

Enterprise Software Overview MSSE


41
CMPE272 Fall 2019
System V IPC
AT&T introduced these 3 forms of IPC in System V:
• Shared Memory
– Allows one process to allocate memory that other processes can attach and detach
– Process communicate directly through this shared memory(read/write)
– Fastest IPC (no intermediation)
– Information is directly mapped from a memory segment to address space of a
calling process
• Message queues
– Can be considered as an internal linked list within kernel’s address space
– Kernel keeps a linked list of messages, labeled by unique identifiers
– Messages are added to the end of the queue
– Messages can be removed from front, middle or anywhere like voice mail
• Semaphores
– Implemented as a set
– guarding access to a resource
– Used for coordinating activities of processes
– Binary semaphores (Just one key 0/1)
– Counted semaphores (more than one key >=0)
– http://tldp.org/LDP/lpg/node47.html#SECTION00743100000000000000

Enterprise Software Overview MSSE


42
CMPE272 Fall 2019
Sockets
• Sockets are extension of pipes
• Commonly used for client/server relationships
• Can be used as locally between 2 apps or remotely between
apps on different machines
• TCP/IP apps communicate through sockets
• An application connects to a port number using socket (http,
ftp, telnet)
• Port defines what type of server program will be used
– http uses port 80
– ftp uses 21

Enterprise Software Overview MSSE


43
CMPE272 Fall 2019

You might also like