Chapter 1: Introduction

공부하자·2022년 9월 10일
0

운영체제

목록 보기
1/12

What Operating Systems Do

Computer System Structure

  • Computer system can be divided into four components:
    • Hardware – provides basic computing resources
      • CPU, memory, I/O devices
    • Operating system
      • Controls and coordinates use of hardware among various applications and users
    • Application programs – define the ways in which the system resources are used to solve the computing problems of the users
      • Word processors, compilers, web browsers, database systems, video games
    • Users
      • People, machines, other computers

아래에서부터 Hardware, Operating system, Middleware, Application programs, Users가 계층을 이루며 존재한다.

Abstract View of Components of Computer

I/O device에는 sensor, controller(actuator) 등도 포함된다.

OS는 computer hardware를 잘 관리해서 다양한 application program들이 쉽게 컴퓨팅 자원을 이용할 수 있도록 조종자 역할을 한다.

What Operating Systems Do

  • Depends on the point of view
  • Users want convenience, ease of use and good performance
    • Don’t care about resource utilization
  • But shared computer such as mainframe or minicomputer must keep all users happy
    • Operating system is a resource allocator and control program making efficient use of HW and managing execution of user programs
  • Users of dedicate systems such as workstations have dedicated resources but frequently use shared resources from servers
  • Mobile devices like smartphones and tables are resource poor, optimized for usability and battery life
    • Mobile user interfaces such as touch screens, voice recognition
  • Some computers have little or no user interface, such as embedded computers in devices and automobiles
    • Run primarily without user intervention

OS는 사용자 관점에서는 컴퓨팅 자원을 쉽게 사용하게 해준다. 다양한 리소스 사용을 도와주고 있다. 사용자는 전혀 신경을 쓸 필요가 없다. 일반 사용자에겐 쉬운 인터페이스를 제공하고, 사용자가 프로그래머라면 API 등을 제공한다.
mainframe, minicomputer, cloud, blockchain 등 여러 사용자가 사용할 때는 리소스를 관리하고 여러 프로그램을 제어해주는 역할을 한다.
workstation에서 원하는 작업을 할 수 있다.
mobile device는 휴대성이 뛰어나지만 cpu, memory, battery 등의 자원을 적게 가지고 있다. network로 서버나 클라우드에 연결해서 필요한 부분을 보충해서 사용한다.
임베디드 시스템은 내장형 시스템으로 항공기, 자율주행자동차, 스마트tv 안에 들어가 있다. 모니터링 또는 제어의 용도로 넓게 사용된다.

Defining Operating Systems

  • Term OS covers many roles
    • Because of myriad designs and uses of OSes
    • Present in toasters through ships, spacecraft, game machines, TVs and industrial control systems
    • Born when fixed use computers for military became more general purpose and needed resource management and program control

OS는 사용 용도가 다양하다. 임베디드 시스템에서 산업 제어의 용도로 사용되고 있다. 기본 기능은 동일하고 시스템의 특성에 따라 OS의 기능이 조금씩 달라지고 있다.

  • No universally accepted definition
  • “Everything a vendor ships when you order an operating system” is a good approximation
    • But varies wildly
  • “The one program running at all times on the computer” is the kernel, part of the operating system
  • Everything else is either
    • a system program (ships with the operating system, but not part of the kernel) , or
    • an application program, all programs not associated with the operating system
  • Today’s OSes for general purpose and mobile computing also include middleware – a set of software frameworks that provide addition services to application developers such as databases, multimedia, graphics

운영체제는 보통 HW에 포함되어 온다.
kernel은 운영체제에서 핵심 부분이다. kernel은 민감한 부분을 다루고 있어서 커널만이 커널 모드로 동작하고 민감한 자원을 지원하는 instruction을 수행할 수 있다. 이를 previleged instruction이라고 한다.
OS는 Kernel을 포함한다. (OS 안에서 핵심적인 부분을 Kernel이라고 부른다.)
System Software는 Middleware와 OS를 포함한다. compiler와 library도 포함한다.
middleware는 OS와 App 사이에 있다.

Computer-System Organization

Computer System Organization

  • Computer-system operation
    • One or more CPUs, device controllers connect through common bus providing access to shared memory
    • Concurrent execution of CPUs and devices competing for memory cycles

computer system에는 cpu가 있다. cpu에서는 다양한 계산처리와 논리연산을 수행한다.
컴퓨터 프로그램이 수행되려면 메모리에 로딩되어야 한다.
executable file, object file 이러한 것들은 처음에 disk에 있지만 부팅이 되면 OS가 메모리에 올라오고, 다양한 app program도 executable file은 disk나 solid state disk 등 저장장치(stable storage) 비휘발성 메모리에 있다가 메모리에 로딩이 되어야 한다.
그밖에는 I/O로 I/O device가 있고 device controller가 있다. device는 I/O라고 말하기도 하고, controller는 device를 제어한다. 각 device controller는 device마다 다르다. device마다 특성과 제어 방법이 다르기 때문이다. 모두 hw의 범주에 속한다.

이러한 cpu, memory, device들을 연결해주는 통로가 system bus이다.

프로그램을 시작하면 OS나 APP은 모두 메모리에 로딩된다. CPU가 memory로부터 명령어를 가지고 와서 해당하는 명령을 수행한다. 명령에는 논리적인 연산도 있지만 cpu memory 데이터 이동도 있고, cpu와 IO controller와 data의 이동을 위한 명령도 있다.

Computer-System Operation

  • I/O devices and the CPU can execute concurrently
  • Each device controller is in charge of a particular device type
  • Each device controller has a local buffer
  • Each device controller type has an operating system device driver to manage it
  • CPU moves data from/to main memory to/from local buffers
  • I/O is from the device to local buffer of controller
  • Device controller informs CPU that it has finished its operation by causing an interrupt

프로그램이 수행되려면 메모리에 로딩 되어야 한다.
I/O device와 CPU는 (서로 데이터를 주고 받을 수는 있지만) 개별적으로 움직인다. 동시에 움직일 수 있는 능력이 있다.
I/O controller도 복잡한 것은 cpu, memory, os까지 있는 것도 존재한다.
device controller는 각 device type마다 다르다.
device controller에는 local buffer가 있다. 작은 메모리이다.
device driver는 OS의 일부분이다. device controller를 제어한다.
HW 영역에 device와 device controller가 존재하고 OS 영역에 device drive가 존재한다.
CPU는 메모리, device의 로컬 버퍼 간의 데이터 이동이 있다.
local buffer는 컨트롤러에 있는 일시적인 IO 데이터를 저장하기 위한 일시적인 공간이다.
I/O device와 cpu는 동시에 동작한다. cpu는 상대적으로 빠르고 I/O는 상대적으로 느리다.
CPU가 I/O에 명령을 내리고 I/O가 천천히 일을 한다. 일이 끝났을 때 cpu에 interrupt를 걸어준다. I/O가 가져온 데이터를 가지고 I/O 처리를 수행한다
interrupt는 여러 용도로 사용된다. 이벤트를 처리한다. 이벤트 중 하나는 cpu가 시킨 일을 다 했을 때 끝난 것 자체가 이벤트이다.

Common Functions of Interrupts

  • Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines
  • Interrupt architecture must save the address of the interrupted instruction
  • A trap or exception is a software-generated interrupt caused either by an error or a user request
  • An operating system is interrupt driven

Interrupt의 기능에 대해 알아본다.
event가 다양하기 때문에 Interrupt도 다양하다. 즉, interrupt가 올때마다 해야하는 service routine가 다르다. 이러한 Interrupt를 구분하기 위해서 Interrupt vector가 있다. interrupt vector로 interrupt service routine 주소를 계산한다.
interrupt가 오면 정상적인 프로그램이 있으면 프로그램이 interrupt를 받으면 interrupt service routine(ISR)으로 jump를 하고 ISR을 수행하고 원래 프로그램으로 돌아온다.
여러 프로그램이 있으므로 ISR이 끝난 후에 Interrupt를 당한 프로그램이 수행된다는 보장은 없다. 하지만 정상적인 프로그램이 수행되는 환경이다.
그래서 원래 프로그램 상태를 잘 저장해야 return이 될 때 자기 프로그램을 계속해서 수행할 수 있는 것이다.
프로그램을 수행하다가 function을 수행할 수도 있는데 return이 됐을 때 원래 위치를 잘 보관해야 하는 것과 유사하게 생각하면 된다.

interrupt 외에도 trap, exception이라는 말이 있는데 이 또한 interrupt의 일종이다.
trap의 exception은 주로 software interrupt를 이야기한다. interrupt는 종류가 다양하다.

interrupt 매카니즘은 hw에서도 지원되어야 하고, os에서 이용한다.

Interrupt Timeline

그림으로 다시 정리한다. 그림에서 위는 cpu, 아래는 I/O이다.
cpu에서는 user program이 수행된다. 아래 부분은 interrupt를 처리하는 부분이다. 나머지는 정상적인 원래 프로그램이다. (HIGH : ACTIVE, LOW : Interrupt 처리)
I/O는 아래가 일을 하는 단계를 말하고 위는 I/O가 놀고 있는 것이다. (HIGH : NON-ACTIVE, LOW : ACTIVE)

CPU에서 I/O request를 하고 I/O device로 전달되면 I/O를 수행하는데 많은 시간이 소모된다. CPU를 양보한다. I/O가 다 끝나면 CPU에 interrupt를 건다. Interrupt Service Routine을 수행한다. I/O의 일이 끝난 다음에 읽어온 데이터를 처리한다.

(반복) Interrupt가 끝난 이후에도 I/O request를 할 수도 있다. I/O는 일을 하고 또 interrupt를 걸고 ISR을 처리한다.

CPU는 I/O에게 일을 시키고, I/O는 일이 끝난 후에 Interrupt를 걸고, CPU에서는 데이터를 처리하는 과정이 반복된다.

Interrupt가 있어서 계속해서 일을 기다리지 않을 수 있는 것이다.

CPU는 빠르고, I/O는 느리다.

Conputer Startup (어디?)

  • bootstrap program is loaded at power-up or reboot
    • Typically stored in ROM or EPROM, generally known as firmware
    • Initializes all aspects of system
    • Loads operating system kernel and starts execution

Interrupt Handling

  • The operating system preserves the state of the CPU by storing registers and the program counter
  • Determines which type of interrupt has occurred:
    • polling
    • vectored interrupt system
  • Separate segments of code determine what action should be taken for each type of interrupt

OS는 일을 시킨 다음에 Interrupt를 당한다. 그래서 register 값, Program Counter 값 등의 상태를 잘 저장해야 한다. 자신이 하던 일을 중지하고 다시 시작해야 하기 때문이다.

Interrupt는 vectered interrupt가 사용되고, 이러한 기능이 없다면 주기적으로 점검하는 polling을 해야 한다.
vector 값을 가지고 해당하는 ISR 시작주소를 계산할 수 있다.

Interrupt-drive I/O Cycle

CPU는 device driver로 I/O request를 한다. device는 일을 한 후에 Interrupt를 걸고 Interrupt service routine(Interrupt handler routine)을 수행한다. 읽어온 데이터를 처리한다.
그 사이에 유용한 일을 할 수 있다. CPU는 여러 프로세스를 동시에 수행시켜야 하기 때문이다.
원래 했던 일을 수행한다. Resume이라고 부른다. save의 반대이다. 자신의 동작 상태를 잘 save한 이후 자신의 차례가 되었을 때 계속해서 일을 할 수가 있다. save한 것을 가지고 자신의 일을 연이어서 하는 것을 resume이라고 한다.

I/O Structure

  • After I/O starts, control returns to user program only upon I/O completion
    • Wait instruction idles the CPU until the next interrupt
    • Wait loop (contention for memory access)
    • At most one I/O request is outstanding at a time, no simultaneous I/O processing
  • After I/O starts, control returns to user program without waiting for I/O completion
    • System call – request to the OS to allow user to wait for I/O completion
    • Device-status table contains entry for each I/O device indicating its type, address, and state
    • OS indexes into I/O device table to determine device status and to modify table entry to include interrupt

I/O를 시작한 다음에 device driver가 I/O에게 일을 시키고 다른 프로세스가 동작하게 된다. I/O가 다 끝났을 때 Interrupt가 걸려서 ISR를 시작하게 된다.

System call은 system에서 지원하는 다양한 service routine을 의미한다. system에서 모든 app이 필요로 하는 다양한 function을 제공한다. system call도 일종의 interrupt로 처리한다. (remind: trap도 일종의 interrupt)
(예시: file access를 위한 read write)
read system call을 했다면 운영체제에 있는 서비스 루틴을 수행하고 원위치로 return되는 과정을 거친다. interrupt를 처리하듯이 system call도 처리한다.

I/O마다 device status table이 있다. 이는 I/O를 관리하기 위한 테이블이다. 운영체제가 다양한 리소스를 관리한다. (process,file,memory,I/O device). 이러한 관리를 위해 테이블이 필요하다.

Storage Structure

  • Main memory – only large storage media that the CPU can access directly
    • Random access
    • Typically volatile
    • Typically random-access memory in the form of Dynamic Random-access Memory (DRAM)
  • Secondary storage – extension of main memory that provides large nonvolatile storage capacity
  • Hard Disk Drives (HDD) – rigid metal or glass platters covered with magnetic recording material
    • Disk surface is logically divided into tracks, which are subdivided into sectors
    • The disk controller determines the logical interaction between the device and the computer
  • Non-volatile memory (NVM) devices– faster than hard disks, nonvolatile
    • Various technologies
    • Becoming more popular as capacity and performance increases, price drops

컴퓨터 구조, 운영체제, app 등에서 넓게 사용하는 중요한 개념이다.
main memory, Hard Disk (HDD), 스마트폰이나 노트북 등에서 쓰는 SSD(solid system drives) = Non-voatile memory(NVM) 등이 있다.

주기억 장치는 random access이다. 메모리 영역을 임의로 access할 수 있다. volatile(휘발성)이다.
이에 반해서 secondary storage(보조 기억 장치)인 HDD나 SSD는 비휘발성 메모리이다.

Storage Definition and Notation Review

기억 장치의 용량을 표현하는 단위이다.
bit는 최소, byte=8bit, word=64bit. 컴퓨터 시스템 마다 다르다.
kbyte, mbyte, terabyte, petabyte로 갈 때마다 1000배씩 증가한다.

Storage Hierarchy

  • Storage systems organized in hierarchy
    • Speed
    • Cost
    • Volatility
  • Caching – copying information into faster storage system; main memory can be viewed as a cache for secondary storage
  • Device Driver for each device controller to manage I/O
    • Provides uniform interface between controller and kernel

storage hierarchy는 컴퓨터 구조, 운영체제, APP의 성능 향상 등에 사용된다.
storage hierarchy는 다양한 메모리의 종류가 있는데 메모리가 계층 구조를 이룬다.
가장 위의 메모리는 register이고, 그 다음 cache, 그 다음 memory, 그 다음 SSD, 그 다음 HDD으로 점점 내려간다.
register와 cache의 일부는 CPU에 있고 CPU에 가까이 있을수록 속도가 빠르므로 위로 올라갈 수록 speed가 빠르다. 하지만 가격은 비싸진다.
volatibility는 휘발성으로, register/cache/memory는 휘발성이고 SSD/HDD는 비휘발성이다.

Storage-Device Hierarchy

primary storage는 cpu에 있는 register, cache, main memory이며 휘발성이다.
secondary storage는 SSD,HDD이며 비휘발성이다. 온라인으로 사용하는 동안 항상 연결이 되어 있다.
third storage는 optical disk나 magnetice tapes이고 비휘발성이다. 대용량 저장이 필요할 때 사용한다.

위로 올라갈수록 storage capacity가 작아지고 비싸지지만 속도가 빨라진다.
밑으로 갈수록 단위 가격당 용량은 커지지만 속도가 떨어진다.

밑으로 갈수록 커다란 저장용량이 있고 위로 올라갈수록 빠르다. (장점)

빠른 것과 대용량의 장점을 동시에 사용하려는 것을 Memory Hierarchy로 표현한다.

크고 빠르게 사용하기 위해 cache를 쓴다. memory hierarchy 상에서 자주 사용하는 것을 위로 올려서 빠르게 access할 수 있다. 대용량 저장 능력이 필요할 때는 밑으로 내려서 저장한다.

How a Modern Computer Works

지금까지 이야기한 computer system과 software 개념을 전체 하나로 표현한 그림이다. cpu와 memory가 있다. memory 안에는 process가 있다.
(process에는 명령어인 instruction과 명령어가 사용하는 data가 있다. function call을 할 때 return address와 local variable을 저장하는 stack도 있다.)

device는 다양한 종류가 있고 hard disk storage도 device의 일종이다.

프로세스는 memory에 로딩되고 프로그램이 수행될 때 cpu는 memory의 instruction을 cpu로 가져와서(fetch해서) 프로그램이 수행된다. thread는 프로그램이 수행하는 기본 단위이다. 프로세스 하나에는 여러 개의 thread가 존재한다.

cpu, memory, device 간의 데이터 이동이 있다.

Direct Memory Access Structure

  • Used for high-speed I/O devices able to transmit information at close to memory speeds
  • Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
  • Only one interrupt is generated per block, rather than the one interrupt per byte

DMA. Direct Memory Access.
DMA는 자기들끼리 데이터를 직접 이동하는 것을 말한다. DMA가 없다면 device와 memory 간의 데이터 이동을 CPU가 중재를 해줘야 한다. 하지만 비효율적이므로 DMA를 사용한다.
즉, DMA로 큰 사이즈의 데이터가 이동할 때 CPU 중재가 없어도 되므로 CPU의 부담을 덜어주는 유용한 기능이다.

Computer-System Architecture

Computer-System Architecture

  • Most systems use a single general-purpose processor
    • Most systems have special-purpose processors as well
  • Multiprocessors systems growing in use and importance
    • Also known as parallel systems, tightly-coupled systems
    • Advantages include:
      • Increased throughput
      • Economy of scale
      • Increased reliability – graceful degradation or fault tolerance
    • Two types:
      • Asymmetric Multiprocessing – each processor is assigned a specie task.
      • Symmetric Multiprocessing – each processor performs all tasks

지금까지는 single system을 위주로 배웠지만 computer systme에는 다양한 형태가 존재한다.
CPU는 Multiprocessors는 cpu가 많이 있다는 것이다. processor와 cpu는 동일한 의미로 사용된다. cpu는 많은 프로그램을 수행해야 해서 bottle lack이 걸릴 수 있는데, multiprocessors 혹은 multicpu 구조를 통해 cpu 성능 제약을 극복하고 있다.
parallel system의 일종이다.
다양한 cpu들은 메모리를 공유한다. 이를 메모리를 공유하는 멀티 프로세스 구조라고 한다. (shared memory multi-processor) 메모리를 공유하기 때문에 긴밀한 관계가 유지된다. (tightly-coupled systems)

장점

  • 처리 능력을 향상시킬 수 있다.
  • 경제적으로 scale을 높일 수 있다. 저가의 cpu를 여러 개 단다. 기술의 한계 때문에 cpu 성능이 엄청 좋아지기 어렵기도 하다.

종류

  • asymmetric : cpu 역할이 서로 다를 때 비대칭 구조
  • symmetirc : cpu 동일한 역할, 대칭 구조

Symmetric Multiprocessing Architecture

cpu가 두 개 있는데 같은 역할을 해서 symmetric multiprocessing 구조이다.
cpu 안에는 register와 cache가 있고, 밖에 main memory가 있다.

A Dual-Core Design

  • Multi-chip and multicore
  • Systems containing all chips
    • Chassis containing multiple separate systems

cpu가 하나인데 cpu core가 여러 개 있다. cpu에서 중요한 역할을 하는 cpu 핵심 device가 여러 개 있다는 것이다.
물리적으로 보면 하나의 칩으로 되어 있다. cpu 칩은 하나지만 core가 여러 개 있다.
size가 작고 전기/전력을 적게 소모하면서 cpu가 여러 개 있는 것과 동일한 효과를 누릴 수 있다.

Non-Uniform Memory Access System

cpu와 memory가 같이 있다. local memory라 빠르게 access할 수 있다.
cpu가 다른 곳에 있는 memory를 access할 때는 interconnect를 이용해서 접근하기 때문에 속도가 느려진다. 이러한 구조를 non-uniform memory access라고 한다.

반대되는 개념으로는 common momory access, COMA이다. 서로 다른 cpu core가 메모리를 access할 때 동일한 시간을 가진다. (이전 슬라이드)

Clustered Systems

  • Like multiprocessor systems, but multiple systems working together
    • Usually sharing storage via a storage-area network (SAN)
    • Provides a high-availability service which survives failures
      • Asymmetric clustering has one machine in hot-standby mode
      • Symmetric clustering has multiple nodes running applications, monitoring each other
    • Some clusters are for high-performance computing (HPC)
      • Applications must be written to use parallelization
    • Some have distributed lock manager (DLM) to avoid conflicting operations

cluter system은 여러 컴퓨터가 모여있는 시스템을 말한다. parallel에는 여러 종류가 있는데 multi-core, multi-processor(multi-cpu), multi-computer가 있다. (곱하기로 많아진다.)
cluster는 multi-computer의 개념이다. storage를 공유할 수 있고 (SAN), computer의 역할이 다른지 같은지에 따라 asymmetric과 symmetric으로 나뉜다.
high-performance computing 시스템이다. 대신 컴퓨터가 여러 개 있을 때는 분산환경에서 리소스를 동시에 사용하기 때문에 충돌을 막아줘야 하는데, 이를 위해 동기화 기법을 사용하고 그 중 하나가 lock manager이다.

PC Moniterboard

하나의 pc에 있는 보드. cpu socket, memory slot, 그밖의 다양한 I/O slot이 있다.

Operating-System Operations

Operating-Sytem Operations

  • Bootstrap program – simple code to initialize the system, load the kernel
  • Kernel loads
  • Starts system daemons (services provided outside of the kernel)
  • Kernel interrupt driven (hardware and software)
    • Hardware interrupt by one of the devices
    • Software interrupt (exception or trap):
      • Software error (e.g., division by zero)
      • Request for operating system service – system call
      • Other process problems include infinite loop, processes modifying each other or the operating system

운영체제의 operation. operating system이 하는 일은 다음과 같다.
처음에 bootstrap 프로그램을 실행한다. kernel을 로딩하는 프로그램이다.
다양한 시스템 daemon들을 동작한다. system daemon은 kernel이라는 핵심적인 부분이 있고, kernel이 어느정도의 범위를 차지하느냐는 운영체제에 따라 다르다. kernel 위에 다양한 데몬들이 동작을 한다. 데몬에는 파일 시스템 데몬, 시스템 로깅 데몬, 인터넷 데몬 등의 다양한 데몬이 존재한다. 데몬이 시작하는 과정은 운영체제 초기화 과정에 속한다.
다양한 interrupt가 있다. interrupt는 event이다. event가 발생했을 때 처리를 해주는 것을 Interrupt Service Routine이라고 할 수 있다. 하드웨어/소프트웨어 인터럽트가 있다. software 에러가 났을 때도 interrupt가 발생한다. system에서 제공하는 유용한 함수도 interrupt처럼 처리하는 과정을 system call이라고 한다.

Multiprogramming and Multitasking

  • Multiprogramming (Batch system) needed for efficiency

    • 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
    • A subset of total jobs in system is kept in memory
    • One job selected and run via job scheduling
    • When it has to wait (for I/O for example), OS switches to another job
  • Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing

    • Response time should be < 1 second
    • Each user has at least one program executing in memory -> process
    • If several jobs ready to run at the same time -> CPU scheduling
    • If processes don’t fit in memory, swapping moves them in and out to run
    • Virtual memory allows execution of processes not completely in memory

multiprogramming은 메모리에 여러 프로그램을 (동시에) 로딩시키는 것이다. cpu가 A 프로그램을 실행하려고 할 때 A에서 instruction을 가져오고, A 수행 이후 B 실행하면 B에서 instruction을 가져온다. 멀티프로그래밍이 아니라면 A 수행하다가 B를 수행하려고 할 때 hard disk에서 로딩을 해야하는데 많은 시간이 걸린다. 그래서 동시에 메모리를 로딩하는 것이 유용하다. 치과에서 의자에서 여러 환자가 대기하고 있는 상태. 준비된 상태에 있는 여러 job들을 동시에 메모리에 로딩시키면 빠른 cpu가 동시에 수행하기 좋은 구조가 될 것이다.
job scheduling은 또 다른 프로그램이 많이 있는데 어떤 것을 메모리에 로딩시킬 것인가를 결정하는 것이다.

Timesharing(multitasking)은 cpu 시간을 잘게 쪼개서 공유한다. (A,B,C가 메모리에 있다면 A를 수행하다 B를 수행하다 C를 수행한다.) cpu 속도가 워낙 빨라서 1msec의 작은 시간이라도 수많은 instruction을 수행할 수 있다. 이렇게 해서 응답시간을 줄일 수 있다. 응답시간이 짧을수록 사용자의 만족도가 높아진다. 짧은 시간 동안 골고루 수행할 수 있도록 하는 것, 시간을 할당하는 것이 CPU scheduling이다.

memory가 좁아서 프로그램이 현재는 A,B,C만 올라와 있지만 A 일부분은 넓은 공간이 필요하다. 공간이 부족해서 넓은 공간을 사용하는 것이 virtual memory 개념이다. VM은 hard disk 공간이다. 메모리 공간이 좁아서 virtual memory로 가는 것이 swap out, virtual memory에서 메모리로 올라가는 것이 swap in이다. 넓은 공간이 메모리에 있는 것처럼 사용한다. harddisk 블록의 빈공간을 찾아서 넓은 virtual memory를 사용한다.

Memory Layout for Multiprogrammed System

멀티프로그램 그림이다. 메모리 안에 OS 뿐만 아니라 여러 프로세스가 올라간다.

Dual-mode and Multimode Operation

  • Dual-mode operation allows OS to protect itself and other system components
    • User mode and kernel mode
    • Mode bit provided by hardware
      • Provides ability to distinguish when system is running user code or kernel code
      • Some instructions designated as privileged, only executable in kernel mode
      • System call changes mode to kernel, return from call resets it to user
  • Increasingly CPUs support multi-mode operations
    • i.e. virtual machine manager (VMM) mode for guest VMs

User mode와 Kernel mode.
cpu에는 instruction이 user mode인지 kernel mode인지를 구분한다. instruction에는 privileged instruction이 있다. 자원을 컨트롤하는 것은 운영체제 커널만이 자원을 제어할 수 있다. user mode와 kernel mode가 분리돼서 이를 설정한다.
kernel이 동작할 때는 kernel이 동작하고 privileged로 제어한다. 일반 프로그램은 user mode로 동작해서 privileged instruction을 수행할 수 없고, 자원을 직접 할당하는 것이 아니라 kernel에 부탁해서 kernel이 privileged instruction을 통해서 자원을 할당한다.

VMM이 추가로 있을 수 있다. 하드웨어가 있는 것처럼 흉내를 내는 것. VMM은 user mode kernel mode 사이에서 또다른 mode가 필요하다.

Transition from User to Kernel Mode

  • Timer to prevent infinite loop / process hogging resources
    • Timer is set to interrupt the computer after some time period
    • Keep a counter that is decremented by the physical clock
    • Operating system set the counter (privileged instruction)
    • When counter zero generate an interrupt
    • Set up before scheduling process to regain control or terminate program that exceeds allotted time

timer라는 하드웨어가 있는데 다양한 용도로 사용하고 있다. time sharing 할 때 time 설정을 한다. 시간이 되면 timer interrupt가 걸려서 A가 할당받은 시간이 끝났으므로 B로 cpu 사용권을 넘기게 된다.

user process가 동작하다 kernel mode가 동작하는 것을 표현하는 그림이다. mode bit가 1이면 user mode, mode bit가 0이면 kernel mode라고 cpu가 정해졌다고 가정한다.

system call은 kenel에 있는 다양한 서비스 루틴을 말한다. 일반 프로그램이 동작하다 system call을 하면 kernel mode로 동작해야 한다. mode change가 일어난다. 일반 app은 user mode에서 동작하고, system call은 kernel mode로 동작해야 한다. 앞서 이야기한대로 system call도 interrupt처럼 사용한다. trap을 불러서 interrupt service routine(system call)을 수행하고 return 된다.

Resource Management

Process Management

  • A process is a program in execution. It is a unit of work within the system. Program is a passive entity, process is an active entity.
  • Process needs resources to accomplish its task
    • CPU, memory, I/O, files
    • Initialization data
  • Process termination requires reclaim of any reusable resources
  • Single-threaded process has one program counter specifying location of next instruction to execute
    • Process executes instructions sequentially, one at a time, until completion
  • Multi-threaded process has one program counter per thread
  • Typically system has many processes, some user, some operating system running concurrently on one or more CPUs
    • Concurrency by multiplexing the CPUs among the processes / threads

운영체제에는 다양한 기능이 있는데, process/memory/file/IO 자원을 관리한다.
첫 번째 기능으로 process 관리가 있다.
프로그램은 하드디스크에 존재한다. 소스 프로그램을 짜서 컴파일을 하면 executable file이 생기는데 파일 시스템에 존재하는 것이다. passive entity이다.
프로그램을 수행하면 active entity이다.
예를 들어서 기계 사용 설명서가 프로그램이고 사용 설명서대로 어떠한 작업을 하는 action이 프로세스이다. 프로그램은 매뉴얼이다.
프로세스는 cpu, memory, I/O file을 활용하게 된다. 메모리 할당 프로그램 등이 있다.
프로그램이 실행됨으로써 프로세스나 쓰레드가 생성된다. 프로세스가 있는데 쓰레드는 프로그램을 수행하는 기본 단위이다. 프로세스 하나에 여러 개의 쓰레드가 존재할 수 있다.
program counter는 프로세스가 있다면 어디까지 수행을 했느냐, 매뉴얼 1,2,3,4 step이 있는데 몇 번째 스텝을 하고 있는지!

Process Management Activities

The operating system is responsible for the following activities in connection with process management:

  • Creating and deleting both user and system processes
  • Suspending and resuming processes
  • Providing mechanisms for process synchronization
  • Providing mechanisms for process communication
  • Providing mechanisms for deadlock handling

프로세스 관리. 프로세스를 만들고 종료시키고 중단시키고 다시 계속한다. 여러 가지 프로세스는 동시에 동작한다. 이때 프로세스 간의 동기화(충돌 방지),통신,deadlock handling(서로가 기다림)이 필요하다.

Memory Management

  • To execute a program all (or part) of the instructions must be in memory
  • All (or part) of the data that is needed by the program must be in memory
  • Memory management determines what is in memory and when
    • Optimizing CPU utilization and computer response to users
  • Memory management activities
    • Keeping track of which parts of memory are currently being used and by whom
    • Deciding which processes (or parts thereof) and data to move into and out of memory
    • Allocating and deallocating memory space as needed

메모리 관리는 메모리 영역이 있다면 어느 부분을 A process가 사용하고, 어느 부분은 OS가 사용하고 메모리 할당을 해줘야 한다. 메모리는 메모리 주소 공간을 어느 프로세스가 어느 공간을 쓸지. A가 종료되거나 메모리가 부족해서 swap out이 되거나. 모든 프로그램이 메모리에 로딩되는 게 아니라 가상 메모리로 swap out 당하고 실행될 때 swap in이 되고. 언제 사용하는지. 독립적인 챕터.

File-system Management

  • OS provides uniform, logical view of information storage

    • Abstracts physical properties to logical storage unit - file
    • Each medium is controlled by device (i.e., disk drive, tape drive)
      • Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random)
  • File-System management

    • Files usually organized into directories
    • Access control on most systems to determine who can access what
    • OS activities include
      • Creating and deleting files and directories
      • Primitives to manipulate files and directories
      • Mapping files onto secondary storage
      • Backup files onto stable (non-volatile) storage media

파일 시스템. logical view. 파일이 연속적으로 있는 것처럼 활용한다. 파일은 실제로 hard disk나 ssd에 할당이 된다. 이 때는 연속적으로 할당 받는 것이 아니라 그때 그때 빈자리를 찾아서 들어간다. 볼때는 locgical이지만 실제로는 흩어져있는 빈공간에 들어간다. 잘 indexing을 해줘야 한다.

폴더나 디렉토리 관리도 파일 시스템 관리의 일부분이다. OS에서는 파일을 만들고 지우고 파일을 읽고 쓰고 파일이 있는 공간인 hard disk에 mapping하는 역할을 한다.

Mass-Storage Management

  • Usually disks used to store data that does not fit in main memory or data that must be kept for a “long” period of time
  • Proper management is of central importance
  • Entire speed of computer operation hinges on disk subsystem and its algorithms
  • OS activities
    • Mounting and unmounting
    • Free-space management
    • Storage allocation
    • Disk scheduling
    • Partitioning
    • Protection
  • Some storage need not be fast
    • Tertiary storage includes optical storage, magnetic tape
    • Still must be managed – by OS or applications

mass storage는 hard disk라던지 solid state disk를 생각하면 된다. file은 logical view이다. hard disk storage를 어떻게 저장할지.
주기억장치와는 달리 오랫동안 저장한다. mass storage 관리를 할 때 OS에서는 여러 기능을 제공한다. mounting(하드디스크를 파일 시스템에 연결하는 것)/unmounting 기능, 하드디스크 빈공간 관리, 어떤 파일에 어떤 블록을 사용할지, hard disk를 여러 프로세스가 access해야 하는데 device controller가 있지만 proccess가 file access할 때 controller는 한 번에 한 가지 일을 처리해서 disk scheduling이 필요하다. 동시에 access하려 할 때 어떤 순서대로 hard disk를 access하게 할 것인가. parti, 커다란 storage를 쪼개서 하나의 file system에 할당해준다. protection은 어떠한 사용자가 어떠한 기능을 할 수 있는지. 멀티 유저 환경에서 사용자마자 자신의 파일이 존재한다. 내 파일에 대해서는 모든 권한, 그룹에는 read만 .. 이러한 protection 기능이 있다.

Caching

  • Important principle, performed at many levels in a computer (in hardware, operating system, software)
  • Information in use copied from slower to faster storage temporarily
  • Faster storage (cache) checked first to determine if information is there
    • If it is, information used directly from the cache (fast)
    • If not, data copied to cache and used there
  • Cache smaller than storage being cached
    • Cache management important design problem
    • Cache size and replacement policy

cache는 memory hierarchy를 생각하면 된다. register, cache, memory, ssd, Hd. 위로 갈수록 속도가 빨라지고 아래로 갈수록 storage가 커진다. 빨리 access하기 위해 hard disk는 memory에 cache하고, memory는 cache에 cache하고, cache는 register에 할당받고. 이런 것을 caching이라고 한다.
컴퓨터 구조에서 cache는 메모리에 있는 것중 자주 사용하는 것을 hardware cache에 caching하는 것을 cache라고 부른다. 운영체제에서는 넓은 의미의 cache를 생각하면 된다.

hd나 ssd에서 자주 사용하는 것을 메모리에 로딩하는 것이 cache이다.
메모리를 hardware cache에 올리는 것이 컴퓨터 구조가 하는 역할이다.
ssd가 memory에 올리는 것이 운영체제가 하는 역할이다.

자주 사용하는 것을 위로 올리는 것이다.

Characteristics of Various Types of Storage


Movement between levels of storage hierarchy can be explicit or implicit.

성격이 틀리다. 위로 갈수록 빠르고 아래로 갈수록 저장공간이 많다. 한레벨마다 100배 정도 빨라지고 저장공간은 1000배 정도 많아진다.
bandwidth. 단위 시간당 얼마나 많은 데이터를 이동할 수 있는지.
이러한 것을 누가 관리하는지. cache는 컴퓨터 구조에서 관리한다. main memory, ssd, hd 등은 os가 관리한다. register는 컴퓨터 구조가 관리하지만, compiler라고 표현한 이유는 프로그래머가 register variable을 선언하면 compiler가 변수를 register에 할당해서 빨리 동작하게 할 수 있기 때문이다.

Migration of data "A" from Disk to Register

  • Multitasking environments must be careful to use most recent value, no matter where it is stored in the storage hierarchy

  • Multiprocessor environment must provide cache coherency in hardware such that all CPUs have the most recent value in their cache
  • Distributed environment situation even more complex
    • Several copies of a datum can exist
    • Various solutions covered in Chapter 19

디스크에 있는 것을 실제로 읽어서 cpu가 처리하려면 register까지 migration이 되어야 한다.
disk에 있는 것을 hardware register까지 와야 처리가 가능하다.
copy가 되는데, 메모리 heirachy 상에서 밑에서 위로 올리는 것을 cache라고 한다. 밑에 있는 것이 지워지는 것이 아니다. 아래에 있는 것은 그대로 남아있다. 분산 환경이나 멀티 프로세서 환경에서 옆으로 copy하기도 한다. 이를 같은 level에서 성능 향상을 위해 copy하는 것을 replication이라고 한다. 성능 향상을 위해 필요한 작업이다. 하지만 중복이 되기 시작하면 복잡한 일들이 생긴다. 일치성을 유지해야 하기 때문이다. 이를 cache coherency, cache consistency라고 한다. 복제된 데이터의 불일치를 일치성을 유지하게 하는 것이다. cache coherency는 그 직전에 write된 것을 read할 수 있어야 한다. consistency는 multi processing 환경에서 동시에 한 데이터를 access하는데 문제 없게 전체가 합의를 본 것처럼 일정한 순서로 데이터 처리가 일어나는 것을 consistency라고 할 수 있다. 중복된 데이터가 충돌이 나지 않게 하는 것으로 coherency와 consistency를 동일하게 생각해도 된다.

I/O Subsystem

  • One purpose of OS is to hide peculiarities of hardware devices from the user
  • I/O subsystem responsible for
    • Memory management of I/O including buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)
    • General device-driver interface
    • Drivers for specific hardware devices

I/O device, device controller가 있는데 이는 hardware의 영역이다. device driver는 OS의 영역이다. device driver는 OS에 있는 것인데 hardware와 interface해서 명령어를 request하고 응답을 받는다. device driver는 device마다 다른 것을 처리한다. I/O subsystem은 공통적인 일을 해준다. (buffering, caching, spooling). 이는 모두 일종의 메모리에 일시적으로 저장하고 buffering은 빠른 cpu와 느린 I/O 간의 완충 작용을 해준다. caching은 위로 올리는 것이다. spooling은 buffer의 일종으로, print 작업을 예를 들면 temp directory에 가져다 놓으면 printer가 spool에 있는 것을 하나씩 가져가서 출력한다.

Security and Protection

  • Protection – any mechanism for controlling access of processes or users to resources defined by the OS
  • Security – defense of the system against internal and external attacks
    • Huge range, including denial-of-service, worms, viruses, identity theft, theft of service
  • Systems generally first distinguish among users, to determine who can do what
    • User identities (user IDs, security IDs) include name and associated number, one per user
    • User ID then associated with all files, processes of that user to determine access control
    • Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file
    • Privilege escalation allows user to change to effective ID with more rights

protection은 access control을 이야기한다. 누가 어떠한 리소스에 대해서 어떠한 동작을 할 수 있다. A라는 사용자가 F라는 파일에 대해서 읽고 쓸 수 있다. 리소스를 사용하는 것을 제어하는 것이다.
Security는 외부 공격으로부터 시스템 자원을 보호하는 것이다. security는 CIA라고 이야기한다. Confi..(기밀성), integrity(무결성), Availability(가용성)이다. 외부로부터 공격이 온다면 이러한 것을 못하게 하는 것이다. 이러한 것으로부터 컴퓨터를 보호하는 것이 security이다.
user ID, group ID로 identity를 밝혀야 한다. 어떠한 resource에 대해서 어떠한 허가가 있는지 구분해야 한다.
privilege escalation은 user program이 system call을 부르면 kernel 모드로 동작한다. 사용자 모드에서 커널 모드로 동작하면 hardware disk access 권한이 생긴다. privilege escalation는 사용자에서 커널로 권한이 상승됐음을 의미한다. 어떠한 권한이 있는지 체크해서 허가받은 파일과 operation에 대해서만 허용해준다. 허가된 리소스만을 사용할 수 있다.

Virtualization

  • Allows operating systems to run applications within other OSes
    • Vast and growing industry
  • Emulation used when source CPU type different from target type (i.e. PowerPC to Intel x86)
    • Generally slowest method
    • When computer language not compiled to native code – Interpretation
  • Virtualization – OS natively compiled for CPU, running guest OSes also natively compiled
    • Consider VMware running WinXP guests, each running applications, all on native WinXP host OS
    • VMM (virtual machine Manager) provides virtualization services
  1. 실제 hw는 다르지만 hw가 있는 것처럼 느낀다.
    hw1(hardware1)이 있고 Application Program은 hw1에서는 동작하지 않고 hw2에서만 올라가는 프로그램이다. hw2를 hw1으로 emulation을 하는 기능이 필요하다. 이러한 기능을 virtualization이라고 한다. 즉, 실제 hw1이 hw2가 있는 것처럼 흉내를 내는 것이다.

  2. hw가 하나지만 여러 개 있는 것처럼 느낀다.
    공유의 개념. hardware가 하나 있지만 vm을 여러 개 올려서 가상의 머신으로 동작한다. 소프트웨어적으로 hardware 역할을 해줘서 다른 os가 올라갈 수 있고 해당하는 app들을 돌릴 수 있는 환경이 된다. 물리적으로는 hw가 하나지만 여러 개의 시스템이 있는 것처럼 느낄 수 있다.
    예로는 java vertual machine이 있다. jvm이라는 가상의 머신을 올리는 것이다. 가상의 jvm으로 동작한다. java program이 jvm 위에서 동작할 수 있다. 또 다른 hw2가 있지만 hw2에도 jvm을 올릴 수 있다. jvm을 올리면 하드웨어는 다르지만 원하는 jvm이 있는 것처럼 emulation을 한다던지 interprting을 한다던지 해서 사용할 수 있다.

  • Use cases involve laptops and desktops running multiple OSes for exploration or compatibility
    • Apple laptop running Mac OS X host, Windows as a guest
    • Developing apps for multiple OSes without having multiple systems
    • QA testing applications without having multiple systems
    • Executing and managing compute environments within data centers
  • VMM can run natively, in which case they are also the host
    • There is no general purpose host then (VMware ESX and Citrix XenServer)

hw가 하나인데 여러 개의 OS를 동작하기 위한 virtual machine. 아래 두 개의 경우가 있다.
1. hw가 하나 있는데 vm을 여러 개 올려서 서로 다른 os가 올라가는 경우
2. hw가 하나 있지만 host OS를 사용하고 그 위에 vm을 올려서 guest os를 사용하는 경우

vmware의 예제이다. hardware가 있고 OS가 여러 개 있어서 서로 다른 프로그램을 올릴 수 있는 형태이다. vmware가 이러한 스타일로 동작한다.

Distributed Systems

  • Distributed computiing
    • Collection of separate, possibly heterogeneous, systems networked together
      • Network is a communications path, TCP/IP most common
        • Local Area Network (LAN)
        • Wide Area Network (WAN)
        • Metropolitan Area Network (MAN)
        • Personal Area Network (PAN)
    • Network Operating System provides features between systems across network
      • Communication scheme allows systems to exchange messages
      • Illusion of a single system

여러 개의 컴퓨터가 있다. multi-computer이다. 컴퓨터가 여러 개 있지만 network로 연결되어 있다. 여러 computing resource를 공유한다.
마치 한 대의 컴퓨터처럼 느낄 수 있게 한다.

Kernel Data Structures

  • Many similar to standard programming data structures

  • Singly linked list

  • Doubly linked list

  • Circular linked list

singly linked list는 데이터를 포인터를 통해서 여러 개의 데이터를 연결한다.
doubly linked list는 앞뒤로 연결된다.
circular linked list 는 맨앞과 맨뒤가 연결된다.

그 밖에 sequencial list는 buffer를 생각하면 된다.(kernel에서 이용하고) 연속적인 메모리 공간을 사용한다.
흩어져 있는 공간을 사용하는 것이 linked list이다.

stack는 LIFO, queue는 FIFO의 성격이 있다.

  • Binary search tree
    • left <= right
      Search performance is O(n)
      Balanced binary search tree is O(lg n)

트리. left child, right child 포인터가 있다. 이러한 구조는 binary search 할 때 숫자로 정렬되어 편하다. 평균 n/2번을 찾아야 하는데 logn번만에 찾아갈 수 있다.

  • Hash function can create a hash map

  • Bitmap – string of n binary digits representing the status of n items

  • Linux data structures defined in include files <linux/list.h>, <linux/kfifo.h>, <linux/rbtree.h>

hash는 데이터를 흩어놓겠다는 것이다. data value가 있다면 data의 key값이 있다. key값으로 hash를 해서 결과가 0이 나올 수 있고, maximum n이 있다. n가지로 흩어놓겠다. 0과 n 사이에 33이라는 값이 있다면 어떠한 데이터의 key값이 hash했더니 33이 됐다면 저장한다. 만약 같은 값이 나오면 linked list로 연결한다.

bitmap은 n bit단위로 어떠한 정보를 저장하며, 1비트는 0 아니면 1이다.

Computing Environments

Traditinal

  • Stand-alone general purpose machines
  • But blurred as most systems interconnect with others (i.e., the Internet)
  • Portals provide web access to internal systems
  • Network computers (thin clients) are like Web terminals
  • Mobile computers interconnect via wireless networks
  • Networking becoming ubiquitous – even home systems use firewalls to protect home computers from Internet attacks

web server 같은 서버도 있지만 모바일 컴퓨터와 같은 client같은 컴퓨터도 있다. (thin client). 전통적으로는 컴퓨터가 host(server) 형태로 있었고 터미널을 통해 접근했는데 최근에는 mobile computer 또는 pc나 노트북 같은 thin client, 최소한의 기능만 있는 웹 터미널, 자신의 능력이 적어서 server와 연결해서 서비스를 요청하고 응답받는다.

Mobile

  • Handheld smartphones, tablets, etc
  • What is the functional difference between them and a “traditional” laptop?
  • Extra feature – more OS features (GPS, gyroscope)
  • Allows new types of apps like augmented reality
  • Use IEEE 802.11 wireless, or cellular data networks for connectivity
  • Leaders are Apple iOS and Google Android

모바일은 휴대한다는 장점이 있다. 휴대를 하고 다양한 곳에 움직일 수 있어서 위치를 측정할 수 있다. GPS. 자세라던지 각속도도 측정할 수 있다. 모바일 컴퓨팅은 물리적인 것과 연결을 할 수 있다. augmented reality는 cyber와 physical 세상을 연결해준다. 예를 들어서 어느 위치로 가야 나타나는 포켓몬이 있다.

Client-Server

  • Client-Server Computing
    • Dumb terminals supplanted by smart PCs
    • Many systems now servers, responding to requests generated by clients
      • Compute-server system provides an interface to client to request services (i.e., database)
      • File-server system provides interface for clients to store and retrieve files

서버에 모든 자원이 있다. client는 mobile, laptop, desktop 등이 있을 수 있다. client에서 request하고 server에서 수행하고 response하는 형태를 말한다. server에서 하는 서비스는 computing, file 등 다양한 용도의 서비스를 할 수 있다.

Peer-to-Peer

  • Another model of distributed system
  • P2P does not distinguish clients and servers
    • Instead all nodes are considered peers
    • May each act as client, server or both
    • Node must join P2P network
      • Registers its service with central lookup service on network, or
      • Broadcast request for service and respond to requests for service via discovery protocol
    • Examples include Napster and Gnutella, Voice over IP (VoIP) such as Skype

peer to peer는 서버가 따로 없고 client가 서로 정보를 가지고 공유한다. 소셜 네트워크, 블록체인 등의 computing 패러다임으로 곽광받는다.
p2p 구조의 문제는 누가 어떠한 resource를 가지고 있는지 찾아가는 것이 부담된다는 것이다.
lookup service가 있는 경우. 누가 어떠한 정보를 갖고 있는지 directory service를 서버가 가지고 있는 형태. 서버와 p2p의 융합된 형태.
lookup service가 없는 경우. 진정한 p2p.
discovery protocol이 중요한 평가 기준이다.

각자 자원을 가지고 있다.
블록체인도 p2p이지만 여러 node들이 자원을 중복해서 가지고 있다. 중복해서 처리한다. transaction. 중복해서 데이터를 가지고 있다. 안전하다.
원장(data) <-(Read/Write)-> transaction
블록체인에 올라가는 다양한 SW 응용 프로그램 (스마트컨트랙트)
transaction과 데이터 저장을 여러 노드가 중복해서 한다.
중복 replication
전통적인 peer-to-peer는 중복을 항상 가정하지는 않는다.

일부 노드가 failure여도 된다. failure stop 괜찮다. (1/2 멀쩡?) failure byzantin(거짓말)하면 곤란하다. (2/3 멀쩡?)

추가: cache는 위로, 빠르게 함. replication(중복)은 옆으로, 신뢰성과 가용성이 좋음. -> fault torelence.

중복의 장점

  • 신뢰성, 가용성, FT(failure Torelence)가 있다.
  • 확장성이 좋다.

일반 p2p는 클라이언트가 다 있다. 블록체인은 client가 아니라 서버가 중복되어 있다. public block chain은 전세계적으로 흩어져 있다.
블록체인을 받으려면 요청을 하긴 해야한다.
node가 많다.

채굴기에서 기본동작을 하는데 채굴기가 엄청 더 많다고 본다.
이게 블록체인이고 client는 여기에 접속해서 요청한다.
블록체인은 서버가 p2p 형식으로 중복되어 있다. 우리는 지갑을 통해서 transaction을 요청하고 블록체인 노드의 바깥에서 transaction을 요청한다.

블록체인의 핵심은 p2p이다. 바깥에서 지갑을 가지고 요청할 때는 서버처럼 동작한다. 서버라고 생각해도 된다. 한 대의 서버가 아니라 p2p로 되어 있는 것이다.

서버가 전세계적으로 노드가 흩어져 있고 read/write를 한다. 중복이 상당히 심하게 되어 있다. 대부분 읽기이다. 쓰기를 할 때는 문제가 있다. 중복되어 있는 것을 동시 업데이트해야하는데 쉽지 않다.
consistency. 여러 copy가 일치해야 한다.

Cloud Computing

  • Delivers computing, storage, even apps as a service across a network
  • Logical extension of virtualization because it uses virtualization as the base for it functionality.
    • Amazon EC2 has thousands of servers, millions of virtual machines, petabytes of storage available across the Internet, pay based on usage
  • Many types
    • Public cloud – available via Internet to anyone willing to pay
    • Private cloud – run by a company for the company’s own use
    • Hybrid cloud – includes both public and private cloud components
    • Software as a Service (SaaS) – one or more applications available via the Internet (i.e., word processor)
    • Platform as a Service (PaaS) – software stack ready for application use via the Internet (i.e., a database server)
    • Infrastructure as a Service (IaaS) – servers or storage available over Internet (i.e., storage available for backup use)

컴퓨팅 리소스가 흩어져 있다. 공유해서 사용한다. public은 공개, private은 비공개, hybrid는 섞는다.
클라우드 컴퓨팅에서 어떤 서비스를 받을 수 있는지(서비스 레벨)에 따라서 구분된다. IaaS는 인프라, PaaS는 플랫폼, SaaS는 소프트웨어를 서비스 받는다.
인프라는 hardware, storage, os까지 말한다. paas는 데이터베이스, 미들웨어 플랫폼을 말한다. saas는 소프트웨어를 말한다.

기관이나 개인이 컴퓨터를 가지고 있으면 비싸기 때문에 외부의 리소스를 이용한다.
블록체인도 public, private이 모두 있다.

  • Cloud computing environments composed of traditional OSes, plus VMMs, plus cloud management tools
    • Internet connectivity requires security like firewalls
    • Load balancers spread traffic across multiple applications

  • computing service를 virtual machine으로 제공한다.

클라우드의 구조. 다양한 형태의 컴퓨팅 리소스가 있고, 보안을 위한 firewall, 리소스가 오면 로드 밸런싱, customer interface 등의 기능이 있다. 다양한 서비스를 제공하고 있다.

Real-Time Embedded Systems

  • Real-time embedded systems most prevalent form of computers
    • Vary considerable, special purpose, limited purpose OS, real-time OS
    • Use expanding
  • Many other special computing environments as well
    • Some have OSes, some perform tasks without an OS
  • Real-time OS has well-defined fixed time constraints
    • Processing must be done within constraint
    • Correct operation only if constraints met

embedded system은 특정한 용도로 사용되는 컴퓨팅을 이야기한다. embedded system은 범용 컴퓨팅이 아니다. 시스템에 내장되어 있다. 실시간을 요구하지 않고 real-time을 요구하기도 한다.

시간 제약이 있다. 일반 컴퓨팅은 응답 시간이 빠르면 빠를수록 좋다. real-time은 빠르다고 좋은 것이 아니고, 시간 제약(언제까지만)만 맞추면 된다.

real-time은 외부에 event가 발생했다. (자세 제어를 일정 시간마다 해야한다. 자율주행은 어느 시간에 멈춰야 함) 이럴때 real-time OS가 사용된다. Interrupt 처리와 같은 것은 어느 시간 안에 확실하게 보장해야 한다. 일반 컴퓨팅은 예측하기가 힘들다.

Free/Libre and Open-Source Operating Systems

  • Operating systems made available in source-code format rather than just binary closed-source and proprietary
  • Counter to the copy protection and Digital Rights Management (DRM) movement
  • Started by Free Software Foundation (FSF), which has “copyleft” GNU Public License (GPL)
  • Examples include GNU/Linux and BSD UNIX (including core of Mac OS X), and many more
  • Can use VMM like VMware Player (Free on Windows), Virtualbox (open source and free on many platforms - http://www.virtualbox.com)
    • Use to run guest operating systems for exploration

예전에는 프로그램이 굉장히 비쌌다. (closed-source and proprietary)
오픈소스에서는 문제가 있다면 책임을 지지는 않는다.

profile
아주대학교 수업 기록

0개의 댓글