'Kernel'에 해당되는 글 8

  1. 2008.04.02 Slackware [ 슬랙웨어 ]
  2. 2008.04.02 JIFFY 란?
  3. 2008.04.01 GRANULARITY in Kernel
  4. 2008.03.31 Linux Kernel 2.6.x 에서의 Network Layer에 대한 설명
  5. 2008.03.31 Kernel 2.4.x 의 네트워크 계층에 관련된 발표자료
  6. 2008.03.31 TSC(Time stamp counter) to seconds
  7. 2008.03.24 printk 사용시 로그(log) 확인하기
  8. 2007.04.17 KERNEL Intro

Slackware [ 슬랙웨어 ]

출처: http://www.slackware.com/info/

What is Slackware Linux?

The Official Release of Slackware Linux by Patrick Volkerding is an advanced Linux operating system, designed with the twin goals of ease of use and stability as top priorities. Including the latest popular software while retaining a sense of tradition, providing simplicity and ease of use alongside flexibility and power, Slackware brings the best of all worlds to the table.

Originally developed by Linus Torvalds in 1991, the UNIX?like Linux operating system now benefits from the contributions of millions of users and developers around the world. Slackware Linux provides new and experienced users alike with a fully-featured system, equipped to serve in any capacity from desktop workstation to machine-room server. Web, ftp, and email servers are ready to go out of the box, as are a wide selection of popular desktop environments. A full range of development tools, editors, and current libraries is included for users who wish to develop or compile additional software.

The Slackware Philosophy

Since its first release in April of 1993, the Slackware Linux Project has aimed at producing the most "UNIX-like" Linux distribution out there. Slackware complies with the published Linux standards, such as the Linux File System Standard. We have always considered simplicity and stability paramount, and as a result Slackware has become one of the most popular, stable, and friendly distributions available.

Slackware Overview

Slackware Linux is a complete 32-bit multitasking "UNIX-like" system.i It's currently based around the 2.4 Linux kernel series and the GNU C Library version 2.3.4 (libc6). It contains an easy to use installation program, extensive online documentation, and a menu-driven package system. A full installation gives you the X Window System, C/C++ development environments, Perl, networking utilities, a mail server, a news server, a web server, an ftp server, the GNU Image Manipulation Program, Netscape Communicator, plus many more programs. Slackware Linux can run on 486 systems all the way up to the latest x86 machines (but uses -mcpu=i686 optimization for best performance on i686-class machines like the P3, P4, and Duron/Athlon). 

 

JIFFY 란?

Jiffy의 원어는 알 수 없다.

" 짧은 순간 "
> 18세기 영국에서 유래된 것으로 여겨지며. 
일반적으로  "매우 짧은 순간"을 의미
> 다양한 분야에서 기본 단위(Unit)를 표현할 때 사용 

[ 과학 분야 ] 

과학 분야에서는 jiffy는 다양한 측정 시간의 단위로 쓰인다. 가장 많이 쓰인다고 여겨지는 것은 10 ms 이다.
특히 물리학에서는 특정거리(1피트/1센티미터 혹은 양자나 중성자의 지름)를 움직이는데 걸리는 시간을 의미한다.

[ 컴퓨터공학  분야 ]
 

컴퓨터 분야
에서 jiffy는 종종 연속된 클럭의 주기를 의미한다.
운영체제  유닉스 계열에서 연속된 CPU Tick Count 의 시간을 측정하여 사용한다. 
일반적으로 10ms라고 여겨지지만, CPU의 Hz 변화로 인해 최근에는 CPU 클럭과 OS 특성에 따라 다양한 값을 가질 수 있다. 

[ 전기/전자 분야 ] 
  

전자공학에서는 jiffy는 AC(교류전류)의 한 주기를 완성하는 데 걸리는 시간이며, 미국의 경우 1/60초에 해당한다.

 


GRANULARITY in Kernel

사전에는 "입도/단위" 라고 되어있다.
kernel 개념에서는 그렇다면 GRANULARITY 라는 단어는 어떤 의미로 쓰였을가?

Kernel에는 여러가지 단위가 존재한다.
예를 들어 시간과 관련된 것에는

Micro-seconds, Milli-Seconds, Nano-Seconds 등등
하지만 이런 것들은 단위가 비슷하면서도 다르다.

위의 요소들은 CPU의 Ticks의 값에 의해 좌우된다.
같이 비교할 수 있는 공통 요소가 있는 셈이다.

이때 Ticks는 GRANULARITY의 의미를 취할 수 있다.
예가 좀 부실하다...

다른 예를 들어볼까?

초코파이가 Box가 있다.
A Box는 20개로 구성된 Box고, B Box는 12개로 구성된 Box 다.

앗! 이미 우리는 Box 를 설명하면서 초코파이 1개를 기준으로 제시하고 있다.
쓰윽 보기엔 다른 단위이지만, 비교를 위한 초코파이 1개의 단위는...
위에서 계속 설명하는 GRANULARITY의 개념을 보여주고 있다.

이 예시에서 GRANULARITY는 초코파이 1개가 된다. 

Linux Kernel 2.6.x 에서의 Network Layer에 대한 설명


출처 : ZDNet Korea 빌더
내용 : Kernel Level 의 Network 계층간 Function 및 Handler 에 대한 설명

Kernel 2.4.x 의 네트워크 계층에 관련된 발표자료


출처 : 포항공대
내용 : Kernel Level 의 Network 계층간 Function 및 Handler 에 대한 설명

TSC(Time stamp counter) to seconds

최근 Intel 계열 CPU에는 하드웨어적인 시간 counter가 존재한다.

CPU가 동작하고 나서 지속적으로 counting 되며, OS(Windows, Linux 등)는 TSC 값을 가지고 시스템 시간을 유지하기도 한다.

TSC 는 CPU의 Hz(Hertz) 값을 기준으로 증가하며,
흔히 CPU Ticks라 말하기도 한다.

그렇다면 TSC와 같이 단순 counter를 우리가 사용하는 시간단위로 바꾸기 위해서는
무엇이 필요할까?

위에서 언급한 "CPU의 Hz(Hertz) 값을 기준으로 증가"에서 힌트를 얻을 수 있다.

!! CPU의 Hz 값에 따라 1개의 counter가 증가하는구나 !!

그럼 Hz는 뭘까?

Hz는 CPU의 성능를 나타내는 단위로 1개의 명령어를 처리하는데 걸리는 시간이다.
1Hz는 1초에 1개의 명령어를 처리할 수 있음을 의미한다.

내가 사용하는 컴퓨터에서
TSC를 이용해 milliseconds를 추출하기 위해서는 어떻게 해야할까?

매우 간단하다.

현재 CPU의 Hz를 n이라고 한다면,
1초에 n번의 명령어 or Time Interrupt 가 일어난다는 의미이다.
그렇다면 그만큼 TSC의 값도 증가되었을 것이다

다음은 값을 구하는 방법이다.

CPU Hz : CPU_HZ
A 지점에서의 측정값 : A_VALUE
B 지점에서의 측정값 : B_VALUE
(단, A보다 B가 나중에 일어난다)

A와 B간의 진행 시간을 seconds 로 나타내기 위해서는

A_B_TSC_VALUE = B_VALUE - A_VALUE; (단위 : Time stamp counter value)
A_B_SECONDS = A_B_TSC_VALUE / CPU_HZ; (단위 : seconds)

짜잔! 값은 A_B_SECONDS가 되겠다!



printk 사용시 로그(log) 확인하기

log 는 어떻게 확인할까? /var/log/messages 를 통해 확인할 수 있다.
화면에 출력하는 방법은 다음과 같다.

vi /var/log/messages

vi 이외에도 cat, more, unnamed pipe(명령어 아님) 등을 사용할 수 있다.


KERN_DEBUG, KERN_INFO, KERN_WARNING, KERN_CRIT 등의 argument는 log 출력시 priority에 관련된 것이다. log가 꽉 찼다면, 다시 쓰여질 때 위의 순서에 의해 지워지거나하는 정책이 적용된다.

KERNEL Intro

KERNEL

즐거운 공부가 되었으면 좋겠습니다.
OS(Operating System)의 전반적인 이슈와 이론들을 다루도록 하죠.

FILE SYSTEM
SCHEDULER
NETWORK
DEVICE DRIVER

ETC...

평생 해볼까요?