'CPU'에 해당되는 글 2건

CPU (Central Processing Unit) 


1. CPU (Central Processing Unit)의 개요

 1-1. CPU (Central Processing Unit)의 정의

 - 컴퓨터의 가장 중요한 부분으로서 명령을 해독하고, 산술논리연산이나 데이터 처리를 실행하는 장치
 - 프로그램의 실행과 데이터 처리하는 중추적 기능의 수행을 담당하는 요소

 

 1-2. CPU가 수행하는 세부동작

 1) 공통적 동작 : 

  - 명령어 인출 (Instruction Fetch), 기억장치로부터 명령어를 읽어옴

  - 명령어 해독 (Instruction Decode), 수행해야 할 동작을 결정하기 위해서 인출된 명령어를 해독

 2) 필요시 수행

   - 데이터 인출 (Data Fetch) , 명령어 실행을 위하여 데이터가 필요한 경우에는 기억장치 또는 입출력장치로부터 그 데이터를 읽어옴
   - 데이터 처리 (Data Process), 데이터에 대한 산술적 또는 논리적 연산을 수행
   - 데이터 쓰기 (Data Store), 실행한 결과를 저장

 

2. CPU (Central Processing Unit) 구조와 구성요소

 2-1. CPU (Central Processing Unit)의 구조

ALU, 레지스터, 제어유닛, 내부버스로 구성

 2-2. CPU (Central Processing Unit)의 구성요소

 1) ALU
  - Arithmetic and Logic Unit
  - 각종 산출연산들과 논리연산을 수행하는 회로들로 이루어진 하드웨어 모듈
  - 산술연산: 덧셈, 뺄셈, 곱셈, 나눗셈
  - 논리연산: AND, OR, NOT, XOR 등

 2) 레지스터
  - CPU 내부에 위치한 엑세스 속도가 가장 빠른 기억장치
  - PC(프로그램 카운터), IR(명령어 레지스터), AC(누산기), MAR(기억장치 주소 레지스터), MBR(기억장치 버퍼 레지스터), SP(스택포인터)

 3) 제어유닛
  - 프로그램 코드(명령어)를 해석하고, 그것을 실행하기 위해 제어 신호들(Control Signal)을 순차적으로 발생하는 하드웨어 모듈

 4) CPU 내부버스
  주소버스
   - CPU가 외부로 발생하는 주소정보를 전송하는 신호 선들의 집합
  데이터버스
  - CPU가 기억장치 혹은 I/O장치와 사이에 데이터를 전송하기 위한 신호선의 집합
  제어버스
  - CPU가 시스템 내의 각종 요소들의 동작을 제어하는데 필요한 신호선의 집합

 

3. 명령어 사이클의 종류와 CPU 구성요소의 관계

 1) 인출 사이클
    - 프로그램 카운터(PC)가 가리키는 기억장치 위치로부터 명령어를 인출해옴
    - 레지스터(PC, MAR, MBR, IR), CPU 내부버스

 2) 실행사이클
    - CPU가 인출된 명령어 코드를 해독(Decode)하고, 그 결과에 따라 필요한 연산을 수행
    - 레지스터(AC), ALU, 제어유닛

 3) 인터럽트사이클
    - 인터럽트 요구신호를 검사하고, 현재의 PC 내용을 스택에 저장한 다음에 PC에 해당 ISR의 시작주소를 적재하는 과정
    - 레지스터(MBR, PC, MAR, SP)

  4) 간접사이클
    - 실행 사이클이 시작되기 전에 그 데이터의 실제 주소를 기억장치로부터 읽어오는 과정
    - 레지스터(MAR, IR, MBR), CPU 내부버스

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,

Oracle DB의 OS 상태 조회 스크립트



SELECT SNAP_TIME,

         SUM (CASE STAT_NAME WHEN 'USER_TIME' THEN VALUE END) USER_TIME,

         SUM (CASE STAT_NAME WHEN 'SYS_TIME' THEN VALUE END) SYS_TIME,

         SUM (CASE STAT_NAME WHEN 'BUSY_TIME' THEN VALUE END) BUSY_TIME,

         SUM (CASE STAT_NAME WHEN 'IOWAIT_TIME' THEN VALUE END) IOWAIT_TIME,

         SUM (CASE STAT_NAME WHEN 'IDLE_TIME' THEN VALUE END) IDLE_TIME,

         SUM (CASE STAT_NAME WHEN 'AVG_USER_TIME' THEN VALUE END) AVG_USER_TIME,

         SUM (CASE STAT_NAME WHEN 'AVG_SYS_TIME' THEN VALUE END) AVG_SYS_TIME,

         SUM (CASE STAT_NAME WHEN 'AVG_BUSY_TIME' THEN VALUE END) AVG_BUSY_TIME,

         SUM (CASE STAT_NAME WHEN 'AVG_IOWAIT_TIME' THEN VALUE END)

            AVG_IOWAIT_TIME,

         SUM (CASE STAT_NAME WHEN 'AVG_IDLE_TIME' THEN VALUE END) AVG_IDLE_TIME,

         SUM (CASE STAT_NAME WHEN 'LOAD' THEN VALUE END) LOAD,

         SUM (CASE STAT_NAME WHEN 'NUM_CPUS' THEN VALUE END) NUM_CPUS,

         SUM (CASE STAT_NAME WHEN 'NUM_CPU_SOCKETS' THEN VALUE END)

            NUM_CPU_SOCKETS,

         SUM (CASE STAT_NAME WHEN 'OS_CPU_WAIT_TIME' THEN VALUE END)

            OS_CPU_WAIT_TIME,

         SUM (CASE STAT_NAME WHEN 'PHYSICAL_MEMORY_BYTES' THEN VALUE END)

            PHYSICAL_MEMORY_BYTES,

         SUM (CASE STAT_NAME WHEN 'RSRC_MGR_CPU_WAIT_TIME' THEN VALUE END)

            RSRC_MGR_CPU_WAIT_TIME,

         SUM (CASE STAT_NAME WHEN 'VM_IN_BYTES' THEN VALUE END) VM_IN_BYTES,

         SUM (CASE STAT_NAME WHEN 'VM_OUT_BYTES' THEN VALUE END) VM_OUT_BYTES

    FROM (SELECT STAT_NAME,

                 START_TIME SNAP_TIME,

                 VALUE,

                 VALUE_DIFF

            FROM (SELECT STAT_NAME,

                         TO_CHAR (SNAP_TIME_C1, 'MM.DD HH24:MI') START_TIME,

                         TO_CHAR (SNAP_TIME_C2, 'MM.DD HH24:MI') END_TIME,

                         DECODE (

                            SNAP_TIME_C2,

                            NULL, 0,

                            ROUND (

                               (CASE

                                   WHEN VALUE_2 < VALUE_1 THEN 0

                                   ELSE VALUE_2 - VALUE_1

                                END)

                               / (EXTRACT (

                                     DAY FROM SNAP_TIME_C2 - SNAP_TIME_C1)

                                  * 86400

                                  + EXTRACT (

                                       HOUR FROM SNAP_TIME_C2 - SNAP_TIME_C1)

                                    * 3600

                                  + EXTRACT (

                                       MINUTE FROM SNAP_TIME_C2 - SNAP_TIME_C1)

                                    * 60

                                  + EXTRACT (

                                       SECOND FROM SNAP_TIME_C2 - SNAP_TIME_C1)),

                               1))

                            VALUE,

                         (CASE

                             WHEN VALUE_2 < VALUE_1 THEN 0

                             ELSE VALUE_2 - VALUE_1

                          END)

                            VALUE_DIFF,

                         ROW_NUMBER ()

                         OVER (PARTITION BY INSTANCE_NUMBER, STAT_NAME

                               ORDER BY SNAP_ID)

                            RNUM,

                         SNAP_ID,

                         INSTANCE_NUMBER

                    FROM (SELECT END_TIME SNAP_TIME_C1,

                                 LEAD (

                                    END_TIME)

                                 OVER (PARTITION BY INSTANCE_NUMBER, STAT_NAME

                                       ORDER BY SNAP_ID)

                                    SNAP_TIME_C2,

                                 VALUE VALUE_1,

                                 LEAD (

                                    VALUE)

                                 OVER (PARTITION BY INSTANCE_NUMBER, STAT_NAME

                                       ORDER BY SNAP_ID)

                                    VALUE_2,

                                 STAT_NAME,

                                 SNAP_ID,

                                 INSTANCE_NUMBER

                            FROM (SELECT SNAP.END_INTERVAL_TIME END_TIME,

                                         SNAP.SNAP_ID,

                                         DHO.STAT_NAME,

                                         DHO.VALUE,

                                         DHO.INSTANCE_NUMBER

                                    FROM DBA_HIST_OSSTAT DHO,

                                         DBA_HIST_SNAPSHOT SNAP

                                   WHERE DHO.SNAP_ID = SNAP.SNAP_ID

                                         AND DHO.DBID = SNAP.DBID

                                         AND DHO.INSTANCE_NUMBER =

                                                SNAP.INSTANCE_NUMBER

                                         AND DHO.DBID = (select dbid from v$database) --변경

                                         AND DHO.INSTANCE_NUMBER = (select  INSTANCE_NUMBER from v$instance)  --변경

                                         AND DHO.SNAP_ID >= :3

                                         AND DHO.SNAP_ID <= :4))))

GROUP BY SNAP_TIME

ORDER BY SNAP_TIME


블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,