[1] 운영체제의 개념과 구조

준제로·2023년 7월 30일

해당 글은 inflearn의 <운영체제 공룡책 강의 (주니온)>을 보고 정리하였습니다.

Chapter 1-2 : Introduction & O/S Structures

1.1 What Operating Systems Do

  • An operating system is a software that manages a computer’s hardware 컴퓨터 하드웨어를 관리하는 소프트웨어를 운영체제라고 한다.
  • It also provides a basis for application programs and acts as an intermediary between the computer user and the computer hardware 운영체제는 컴퓨터 사용자와 컴퓨터 하드웨어 사이의 중간 매개역할을 해준다.
  • 크게 4개의 컴포넌트를 가지고 컴퓨터를 생각해볼 수 있다.
    • the hardware
    • the operating system
    • the application programs
    • a user

  • Defining Operating System (운영체제의 정의)
    • There are NO universally accepted definition of an operating system.
    • A more common definition is that
      • “the one program running at all times on the computer” (항상 동작하는 프로그램)
      • usually called the kernel
    • Along with the kernel, there are two other types of programs:
      • system programs
      • application programs

1.2 Computer-System Organization

  • A classical computer system consist of

전통적인 컴퓨터 시스템은 cpu가 있고, 여러 개의 device controller가 bus를 통해 연결되어있다.

이런 형태의 컴퓨터 시스템의 제어를 os가 담당한다.


  • A bootstrap program

    첫번째로 필요한 프로그램이다.
    우리가 컴퓨터를 키는 것을 부팅한다고 하는데, 그 어원도 bootstraping에서 나왔다.

    • is the first program to run on computer power-on
    • and then loads the operating system.
    • 운영체제를 메모리에 로딩해주는 역할을 한다. 그 다음부터는 나머지 응용프로그램들은 운영체제가 알아서 해준다.

  • Interrupts
    • Hardware may trigger an interrupt at any time by sending a signal to CPU, usually by way of the system bus.
  • I/O device 예를 들어, 키보드의 A키를 눌렀다. ⇒ 이게 눌러졌다는걸 cpu에 알려줘야한다! 이럴 때 interrupt를 사용한다.

    • 이렇게 cpu하고, 주변 장치하고 통신하는 방법 중에 하나가 interrupt

  • von Neumann architecture (폰 노이만 아키텍쳐) : fetch, execute 사이클
    • A typical instruction - execution cycle
      • first fetches an instruction from memory (메모리→CPU로)
      • and stores that instruction in the instruction register(IR).
    • The instruction is then decoded
      • and may cause operands to be fetched from memory
      • and stored in some internal register
    • After the instruction on the operands
      • has been executed,
      • the result may be stored back in memory.

  • Storage - device hierarchy

    The wide variety of storage systems can be organized in a hierarchy according to:
    storage capacity and access time에 따라서 여러 개의 계층 구조가 있다.


  • I/O Structure
    • A large portion of OS code is dedicated to managing I/O
    • os kernel은 굉장히 안정적으로 개발되어 있기 때문에, 새로운 디바이스를 제어하는 디바이스 컨트롤러를 만드는 게 주다.
- DMA : Directed Memory Access 디바이스와 디바이스끼리 direct로 access한다.

1.3 Computer System Architecture

  • Definitions of Computer System Components
    • CPU- The hardware that executes instructions
    • Processor- A physical chip that contains one or more CPUs
    • Core - The back computation unit of the CPU
    • Multicore - Including multiple computing cores on the same CPU
    • Multiprocessor - Including multiple processors

이제 cpu 하나에 메모리 하나 있는 구조는 잘 사용하지 않는다.

  • Symmetric multiprocessing (SMP)
    • The most common multiprocessor systems,
    • in which each peer CPU processor performs all tasks.
  • Asymmetric multiprocessing: (거의 안쓴다)
    • each processor is assigned a specific task.
  • 메모리가 한개인데, 메모리에 연결되어있는 cpu가 여러개!
  • 각각의 register와 cache를 가짐
           
  • Multi-core design
    • with several cores on the same processor chip
    • cpu를 여러개를 다는 건 사실 비용이 너무 많이 든다.
    • cpu 하나에 (같은 프로세서 칩 하나에) 여러 개의 core를 두는 방법
- 2개의 코어 ⇒ dual-core / 요즘 비싼 건 8코어까지 나온다고 한다.

1.4 Operating System Operations

  • Multiprogramming
    • runs more than one program at a time. (한개 이상의 프로그램이 실행된다.)
    • keeps several processes in memory simultaneously. (여러 개의 프로세스가 메모리에 동시에 올라가있다.)
    • to increase CPU utilization (cpu의 사용효율을 올릴 수 있다.)
    • program : a set of instructions
Figure 1.12 Memory layout for a multiprogramming system. Figure 1.12 Memory layout for a multiprogramming system.
  • 프로그램을 메모리에 한 개만 로딩해서 썼다.
  • 여러 개의 프로그램을 동시에 메모리에 올려놓고, 동시에 실행시켜주는 것을 멀티 프로그래밍이라고 한다.

  • Multitasking (=multiprocessing)을 할 수 있게 됐다!
    • a logical extension of multiprogramming
      • in which CPU switches jobs so frequently that
      • users can interact with each job while it is running

    • 이걸 하려면 CPU scheduling이 필요하다.
      • if several processes are ready to run at the same time,
      • the system must choose which process will run next
      • 어떤 프로세스를 다음에 실행시킬 지 선택하는 방법이 무엇인가. cpu 효율을 가장 좋게 하면서 (5장에서 중요하게 다루는 내용)

  • Two separate mode of operations: (오퍼레이션 모드)
    • user mode and kernel mode
    • to ensure that an incorrect program
      • cannot cause other programs to execute incorrectly
      • OS를 제외한 프로그램들은 직접적으로 하드웨어를 조작하지 못하게 막아서, 나쁜 짓을 하지 못하게 한다.
kernel 모드에서만 하드웨어 제어 가능!

1.7 Virtualization

  • 가상화 기술

  • Virtualization is a technology that allow us

    • to abstract the hardware of a single computer

    • into several different execution environments

      하나의 cpu에 여러개의 프로세스(=실행중인 프로그램)를 돌릴 수 있는데.. 하나의 hardware 위에 여러 개의 os를 띄울 수 있지 않을까?

    • VMM: Virtual Machine Manager

      • VMware, XEN, WSL, and so on.
  • CPU 스케줄링하듯이, OS VMM 스케줄링을 하면, 동시에 OS가 여러 개 돌 수 있다..?


1.10 Computing Environments

  • Operating Systems in the Variety of Computing Environments (다양해진 Computing Env)
    • Traditional Computing
      • CPU하나에, 메모리 하나
    • Mobile Computing
      • 안드로이드, 아이폰 운영체제
    • Client-Server Computing
      • 웹 브라우저 - 웹 서버
    • Peer-to-Peer Computing
    • Cloud Computing (ex) AWS)
    • Real-Time Embedded Systems (RTOS: Real Time Operating System)

2.1 Operating System Service

  • OS provides an environment for the execution of programs. 운영체제는 컴퓨터 프로그램이 실행될 수 있는 환경을 제공해준다.
    • user interface

    • Program execution

    • I/O operation

    • File-system manipulation

    • Communications

    • Error detection

    • Resource allocation

    • Logging

    • Protection and security


2.2 User and Operating- System Interface

  • Three fundamental ways for users to interface with the OS:
    • CLI, GUI, Touch-Screen Interace

2.3 System Calls

컴퓨터 응용프로그램은 OS와 어떻게 interface 하는가

  • System calls (=OS의 API)
    • provide an interface to the services made by the OS
    • API : Application Programming Interface
  • 일일이 시스템 콜을 쓰기 귀찮으니 라이브러리를 제공해준다.
profile
.....☆

4개의 댓글

comment-user-thumbnail
2023년 7월 30일

와우 정말 좋은정보! 캄사합니다!! 캄사합니다!!!!

1개의 답글
comment-user-thumbnail
2023년 7월 30일

정리가 잘 된 글이네요. 도움이 됐습니다.

답글 달기