Solaris in the depth - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Solaris in the depth

Description:

SONPROC = executing on a CPU. SSTOP = stopped for debugger ... Interactive or CPU-intensive. Time spent on CPU. Time waited in dispatch queue. Memory usage ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 34
Provided by: christer7
Category:

less

Transcript and Presenter's Notes

Title: Solaris in the depth


1
Solaris in the depth
  • Christer Bernérus
  • Project Manager, The Chips project
  • Chalmers University of Technology
  • ltbernerus_at_cs.chalmers.segt

2
Overview
  • What is Solaris ?
  • An operating environment
  • SunOS the kernel
  • Desktop environment. CDE/OpenWindows
  • Both are built around the X windows system
  • Network computing
  • ONC
  • NFS
  • NIS/NIS
  • RPC/XDR

3
The SunOS kernel
  • Evolution
  • Originally derived from 4.2BSD
  • 1983 Sun UNIX 1.0, 4.2BSD base
  • 1985 Sun UNIX 2.0, NFS introduced
  • 1986 SunOS 3.2, 4.2BSD base
  • 1988 SunOS 4.0c, 4.3BSD base
  • 1992 SunOS 5.0, SVR4 based kernel
  • Solaris name introduced

4
Whats what ?
Solaris 1.x
Solaris 2.x
NIS NIS NFS V2 NFS V3 RPC/XDR
CDE OpenWindows Motif Libs X libs
NIS NFS V2 RPC/XDR
OpenWindows X libs
SunOS 4.x
SunOS 5.x
1993 SunOS 5.2 SMP support (sun4d) 1995 SunOS
5.5.1 SMP UltraSparc (sun4u) 1996 SunOS 5.6
64 bit files 1998 SunOS 5.7 64 bit kernel 2000
SunOS 5.8 ?
5
SunOS kernel features
  • Kernel components dynamically loadable
  • Microkernel core. Well defined directory
    namespace for loadable modules
  • Multithreaded kernel components
  • Fine grained locking for concurrency
  • Multithreaded process model
  • User level threads and sync primitives
  • Two level model isolates user threads from kernel

6
SunOS kernel features
  • Table driven dispatcher with multiple scheduling
    class support
  • Dynamically loaded table values
  • Realtime support with preemptive kernel
  • Includes RT features like mempry page locking,
    async I/O etc
  • Dynamic sizing of kernel resources
  • Kernel tuning via text file (/etc/system)
  • Some things can be tuned while system is running

7
SunOS kernel features
  • Tightly integrated virtual memory and file system
    support
  • Dynamic page cache memory
  • Virtual File System (VFS)
  • Disk based, distributed and pseudo file systems
  • New functionality
  • Kernel sockets fia sockfs
  • /proc via (procfs)
  • Doors (doorfs)
  • Floppy fdfs)
  • Swap (swapfs)
  • Temporaty files (tmpfs)

8
SunOS kernel features
  • 32 and 64 bit kernel
  • 64 bit data types (long long)
  • 64 bit files (SunOS5.6)
  • 64 bit VM (SunOS 5.7)
  • DDI/DKI
  • Device driver API
  • Dynamic attach/detach/power

9
SunOS Kernel features
  • Integrated networking
  • TCP/IP
  • Name services DNS, NIS, NIS
  • NFS
  • RPC - remote procedure call
  • XRD - external data representation
  • Sockets, TLI, Federated naming APIs

10
Kernel Organization
User applications and libraries
User level
System calls
Kernel
Filesystem
Buffer cache segmap page structures
Machine-dependent code
Hardware
11
Threads and processes
  • Processes
  • Normal UNIX processes
  • Users address space, stack and process
    descriptor
  • User threads
  • Uses threads library
  • Invisible to operating system
  • Interface for application parallellism
  • Lightweight processes
  • Maps user level threads to kernel threads
  • Always maps to one kernel thread
  • Scheduled by kernel
  • May execute in parallell in multiprocessors
  • Kernel threads
  • Fundamental entity that is scheduled and
    dispatched

12
Threads and processes
Process 1
Process 2
Process 3
Process 4
Process 5
User Level
Threads Library
Kernel Level
P
P
P
P
P
P
Hardware Level
P
User-level Thread
Kernel-LevelThread
Lightweight Process
Processor
13
Process states
debugger
SSTOP
Used up time quantum
SONPROC
SIDL
SRUN
fork()
Syscall()
SSLEEP
SZOMB
exit()
SIDL Being created SRUN Runnable SONPROC
executing on a CPU SSTOP stopped for
debugger SSLEEP blocked in system call SZOMB
terminated, but undead
14
Process structures
UNIX
Solaris 2.X
Process ID
Process ID
User IDs
User IDs


Signal dispatch table
Memory Map
Signal dispatch table
Memory Map
File descriptors
File descriptors
Processor state
Priority
Signal Mask
Registers
Stack
...
LWP 1
LWP 2
LWP 3
15
Scheduling
  • RT, System, TS, Interactive classes
  • LWPs inherit class priority from parent process

16
Scheduling features
  • Four classes
  • System (SYS)
  • Timesharing (TS)
  • Interactive (IA)
  • Real time (RT)
  • Kernel threads are scheduled, not processes
  • Higher priorities are chosen first
  • Scheduling algorithms are table driven
  • More efficient
  • Tunable
  • Real time is supported by
  • a preemptable kernel
  • Page locking in physical memory

17
Priorities
  • 169-160 Interrupt thread priorities
  • 159-100 real-Time priorities
  • 99-60 Kernel priorities
  • 59-0 TS/IA priorities

18
Real Time class
  • Why is Real Time hard in UNIX
  • Page faults
  • Non-preemptable kernel
  • Solaris approach
  • Pages can be locked into main memory
  • Preemption points
  • Preemptable kernel
  • Fixed scheduling priorities
  • Always higher than System or Timeshare threads
  • Priorites are not re-calculated.

19
System class
  • Used by system threads
  • Always in kernels address space
  • Assigned a kernel mode priority

20
Timeshare/Interactive classes
  • Socialistic scheduling class
  • Priority re-calculated regularly based on
  • Interactive or CPU-intensive
  • Time spent on CPU
  • Time waited in dispatch queue
  • Memory usage
  • ...

21
Synchronization
  • Mutex
  • For short code segments lt 300 instructions
  • Spin mutex
  • Spins until unlocked
  • Adaptive mutex
  • Spins if lock holder is running
  • Sleeps if lock holder is not running
  • Condition variables
  • For longer code segments
  • Replaces UNIX sleep/wakeup mechanism
  • A CV represents an event that a thread will block
    for.
  • Threads placed on separate sleep queue

22
Synchronization
  • Reader-writer locks
  • Allows concurrent reads, but denies concurrent
    writes
  • Semaphores
  • Traditional.
  • Can be used as binary or counting
  • Solaris uses kernel semaphores in a few areas for
    resource allocation

23
Memory management
  • System model
  • Uniprocessor
  • Multiprocessor

Main memory MMU Cache
CPU
I/O
Main memory
CPU
CPU
MMU
Cache
MMU
Cache
Write buffers
Write buffers
Mbus
IOMMU I/O
24
Virtual to physical address translation
Stack
Hole
CPU
MMU
Physical address
Data
Virtual address
Text
25
Virtual cache
Stack
Hole
CPU
MMU
Physical address
Cache
Data
Virtual address
No MMU translation on cache hits Aliasing can
occur
Text
26
Physical cache
Stack
Hole
CPU
MMU
Physical address
Virtual address
Data
Cache
No aliasing problems MMU always used
Text
27
Snooping cache
Main memory
CPU
CPU
MMU
Snooping Cache
MMU
Snooping Cache
Write buffers
Write buffers
Mbus
IOMMU I/O
28
Global Memory management
  • Demand paged
  • Not recently used algorithm
  • Dynamic file system cache
  • Who used up all of my memory ?
  • Page scanner

29
Paging and swapping
  • All disk I/O revolves around the VM system as a
    cache manager
  • All of main memory can act as the page cache.
  • Page in
  • Results from the cache managers need to fill the
    main memory (cache)
  • No explicit page_in() routine

30
Page replacement
Back hand Examines reference bits
Page reclaim
Free page
Page freelist
Fixed hand spread
Page structs
Scan rate
Page out
Front hand Clears reference bits
Page daemon
31
Replacement strategy (1GB example)
Scan rate pages/sec
8192
Throttle area Caller must wait until free pages
are available Processes are swapped out
fastscan
Any pages except pages which are shared often
100
slowscan
Nonexecutable file pages
Free memory MB
Scanner starts 4 times/sec
Scanner starts 100 times/sec
32
File management
  • Vnode interface

System calls
Vnode layer
/proc
PCFS
HSFS
UFS
swapfs
tmpfs
NFS
cachefs
Process Address space
Anonymous memory
Diskette
CDROM
33
Local file system layouts
System V File system
4.3BSD Fast file system
Boot block
Boot block
Superblock
Superblock
inodes
Superblock
Cyl. Grp. block
Cylinder group 0
inodes
...
data
data
...
data
Superblock
Cyl. Grp. block
Cylinder group 1
inodes
...
data
Write a Comment
User Comments (0)
About PowerShow.com