'컴퓨터 과학!'에 해당되는 글 35건

  1. 2008.04.23 Matlab에서 Linux 코드 생성하기
  2. 2008.02.27 vi설정
  3. 2007.12.14 SystemC 프로세스 2
  4. 2007.12.09 IDL 2
  5. 2007.03.02 IDL 4
  6. 2007.03.02 CORBA
  7. 2006.05.08 A Flash-Memory Based File System
  8. 2006.04.12 힘들어요. 7
  9. 2006.04.05 4. VM
  10. 2005.10.12 NesC
컴퓨터 과학!2008. 4. 23. 20:08

1. matlabroot/rtw/c/grt/grt_unix.tmf를 복사해와서 수정한다.
   1)    SYS_TARGET_FILE = 근처에
          MAKEFILE_FILESEP = / 를 적어넣는다.
    2)   'ifeq ($(OPT_OPTS),$(DEFAULT_OPT_OPTS))'를 찾아서,
          그 구문에서 else 파트만 남기고 모두 지운다.
    3)   Tool > Real-Time Workshop > Options 에서
          Template makefile 을 1)에서 수정한 파일로 지정
    4) 'Generate code only'  선택, 적용.

2. 코드 생성
    MATLAB에서
    1)   set_param('모델이름','PostCodeGenCommand','packNGo(buildInfo, {'packType',
                         'hierarchical', 'fileName', 'zip파일 이름'});');
          packType은 hierarchical이 좋은 것 같다.
          이렇게 만들면 라이브러리 zip파일과 소스코드 zip파일이 따로 생성되는데,
          라이브러리 zip파일은 원래 계층 그대로라, 포팅이 훨씬 수월하다.
          packNGo는 c,cpp,h 파일만 압축해준다.
          따라서, makefile이나 기타 필요한 파일은 수동으로 복사해야한다.
    2)   build Model
   또는
    1)   cd 모델이름_grt_rtw; // 생성된 코드 디렉토리
    2)   load buildInfo.mat
    3)   packNGo(buildInfo, {'packType', 'hierarchical', 'fileName', 'zip파일 이름'});
    zip 파일을 리눅스 머신으로 옮겨준다~

3. makefile에서 window경로 -> linux경로
    COMPUTER = GLNX86 (x86_64는 GLNXA64)
    Makefile = Makefile
    MATLAB_ROOT =
    ALT_MATLAB_ROOT =
    ADD_INCLUDES =
    MATLAB_INCLUDES =

4. packNGo 에서 옮겨주지 않는 파일 복사
   1) R2007b/rtw/c/tools/unixtools.mk
   2) ~_grt_rtw/~.mk
   3) ~_grt_rtw/rtw_proj.tmw

5. ~.mk -> Makefile로 바꿔준다.
6. make!

출처 : Matlab Help

Posted by 스니
컴퓨터 과학!2008. 2. 27. 15:46
탭 크기 설정
set ts=4
Posted by 스니
컴퓨터 과학!/SCA2007. 12. 14. 21:13
SystemC process는 thread process와 method process가 있는데, 이외에 cthread(clock thread) process와 dynamic process도 있다.

0. 시뮬레이션 커널
시뮬레이션 커널에는  Waiting Pool, Ready Pool, Event Pool이 있고, Ready Pool에 있는 process를 꺼내어 실행하고, return명령으로 함수 실행이 끝나거나  wait()호촐로 process가 일시 정지되면 Waiting Pool로 이동한다. 실행 중인 프로세스에서 event를 notify하면 해당 event를 Event Pool에 넣는다.

Ready pool에 있는 모든 process를 싱행하면 하나의 evaluation단계가 끝나게 되고, event pool에 의해 다음 evaluation 단계가 실행된다.

주의할 점은, evaluation 실행 동안에는 시뮬레이션 시간이 정지한다(zero time)는 점이다. Evaluation이 끝나면 event pool에 있는 event를 보고, 지정된 시뮬레이션 시간이 진행된 뒤, 그에 sensitive한 process를 waiting pool에서 ready pool로 옮기고 다시 evaluation을 실행한다.

Ready pool, wating pool, event pool이 모두 비면 시뮬레이션을 종료한다.

Zero time 안에 실행되는 프로세스의 실행 순서는 non-deterministic이고, 시뮬레이션 결과는 consistency를 유지해야 한다.

sc_module 클래스의 멤버함수를 시뮬레이션 process로 사용하려면 시뮬레이션 커널에 등록해야 한다. 이렇게 등록된 process는 커널의 스케쥴러를 통해 호출된다.
이러한 process는 constructor안에서 등록한다.

1. SC_THREAD  
SC_THREAD( process_name );
process_name은 등록할 멤버함수의 이름이다. 주의할 점은, 프로세스로 등록할 함수는 parameter와 return value가 없다는 것이다. 이는 시뮬레이션 커널이 프로세스를 호출하는 메커니즘을 단순화하기 위해서 만들어진 규칙이다.

Thread process는 시뮬레이터에 의해 한 번만 호출된다. SystemC는 nonpreemptive scheduling 방식을 사용하므로, thread는 return/waiting 이 아니면 시뮬레이터를 독점한다. 따라서 보통의 thread process는 while(true)와 같은 구문에 wait를 가지는 구조로 설계된다.
wait 없이 간접적으로 process가 일시정지 되는 경우도 있는데, FIFO 채널에서 읽을 데이터가 없거나 쓸 공간이 없을 때 가능해 질 때 까지 일시정지된다.

2. SC_METHOD 
SC_METHOD( process_name );
Thread process에 비해 기능이 단순하여 다양한 모델링에 적용하기에는 부족하지만, 가볍기 때문에 효율적이다. Thread process와의 가장 큰 차이점은 wait()를 사용할 수 없으며, return에 의해서만 실행이 중지된다. 또한, event에 의해 여러번 호출될 수 있다.
따라서, method process는 간접적으로 중지될 수 있는 sc_fifo등을 사용하면 안된다.

Tread와 method는 그 이름에서 알 수 있듯이, tread의 경우 중단된 이후애 실행이 resume되었을 때, 그 전의 변수값들이 보존되어있다. 그라나 method process의 경우, 실행 중간에 중단되지 않으며, 실행이 종료된 이후, 이벤트 틍에 의해 시뮬레이션 커널이 다시 호출하였을 때에는 변수값들이 모두 초기화된다. Process를 method로 할 것이냐 thread로 할 것이냐를 결정할 때 이러한 사항도 고려해야 한다.
Posted by 스니
컴퓨터 과학!/SCA2007. 12. 9. 18:05

IDL

인터페이스 정의언어, 구현언어로 매핑을 지원.
객체지향 개념. C++의 class와 비슷하지만,  JAVA의 interface와 더욱 유사.

interface Sample {
    attribute long a; // attribute 키워드 없으면 에러.
    readonly attribute string b;
    string oper1();
    oneway void oper2();
    void oper3() raises(UsrException);
};

간단히 뭐 이런 식.

상속 가능, 다중 상속도 가능, 단 상속 받을 interface간에 같은 이름이 있으면 안됨.
interface A {
    attribute long l;
    void oper();
};
interface B {
    attribute long l; // 이름 충돌 에러 발생
};
interface C: A, B {
    void oper(); // 재정의 시도 에러 발생
};

Scop을 정하고 계층화 하는 module을 사용할 수도 있음.
module CF {
    interface DomainManager{};
    module CF1{
        interface Resource{};
    };
};
CF::DomainManager, CF:CF1:Resource 이런 식으로 접근이 가능함.

이렇게 만들어진 IDL 파일과 실제 구현과의 mapping은 IDL 컴파일러가 하는 것 같은데,
그 과정이 궁금함. 프로그래머는 어느 수준까지 정의해 줘야 하는가?

Posted by 스니
컴퓨터 과학!/SCA2007. 3. 2. 20:16

IDL

The Interface Definition Language (IDL) is the language CORBA defines for specifying the features (methods, attributes) of an object in a language-independent way.
In order to enable different programming languages (and machines, operating systems) to deal with CORBA objects, it's necessary to agree on some standard notation to describe what features (methods, attributes) objects expose. CORBA offers such a standard notation: the Interface Definition Language (IDL). IDL looks a lot like C++ (or Java) class definition. Note that IDL in Microsoft's COM technology context is not the same as CORBA IDL. They are quite similar, however.
Note that IDL only specifies the methods and attributes an object supports - the programmer has complete freedom as how to implement these, as long as he respects the definition in the IDL file.

CORBA가 이종간의 통신을 가능하게 하는 것이기 때문에, 이종간에 인터페이스를 공통으로 정의해 주기 위해서 필요한 것이 IDL 인 것으로 파악됨.
Posted by 스니
컴퓨터 과학!/SCA2007. 3. 2. 20:05
CORBA (Common Object Request Broker Architecture) is a set of standards which define what is called a distributed object system. These standards were written by the OMG (Object Management Group). The OMG is made up of more than 700 firms who are pursuing common agreement on standard protocols. CORBA defines the protocol for interaction between objects. As stated, these object may be written in different programming languages, run on different operating systems, live on different machines.
사용자 삽입 이미지













- http://developer.gnome.org/doc/guides/corba/html/p56.html



분산 환경을 위한 RPC 라고 할 수 있겠다. RPC 처럼 Stub도 있고, skeleton도 있다.
통신 프로토콜이라고 생각하자.

내가 아는 ORB(Object Request Broker)로는 omniORB(OSSIE)와 e*ORB(OSSIE for C64), openORB(SCARIOpen)가 있다.
물론, 그냥 저런게 있다는 정도만 알 뿐이다. 지금으로썬.
Posted by 스니
http://www.usenix.org/events/usenix01/full_papers/kroeger/kroeger_html/node11.html
Andrew Benchmark : Although this benchmark is quite dated, to our knowledge it is the only existing file system benchmark that has been widely used and accurately portrays the predictive relationship between files.


http://julipedia.blogspot.com/2005/09/ffs-lfs-and-mfs.html
Memory File System (MFS): Reserves a contiguous region of memory and lays out blocks in it. This is why MFS is considered inefficient, because it is using the concepts of an on-disk file-system over memory.
Posted by 스니
어제 오늘, 클러스터 노드들 세팅을 했는데...
힘들어요...ㅜ.ㅜ

할일은 자꾸 쌓여만 가고... 우어어ㅡ
Posted by 스니
[4.1 BASIC MEMORY MANAGEMENT]

when a program is linked (the main program, user-written procedures, and library procedures are combined into a single address space), the linker must know at what address the program will begin in memory. (fixed memory partition에서)
그래서 OS/MFT(Multiprogramming with a Fixed number of Tasks, IBM) 에서는 linker가 binary program에 list나 bitmap을 가지고 있었다. (여기에는 reload되어야 하는 것과, opcodes, constants와 같은 reload되지 않아야 할 것들을 구분하고 있다.)

=> protection 문제.
1. 그래서 IBM의 large mainframe인 OS/360은 메모리를 2-KB bytes로 나누고, 4-bit protection code를 각 block에 추가하였다. PSW(Program Status Word)가 4-bit key를 가지고 있고, 이것을 hardware trap으로 체크하였다. (OS만 key, code를 건드릴 수 있음)
2. hardware가 base/limit reg를 제공해도 된다. (user에서 이 레지스터들은 건드릴 수 없음.)
그런데 이 방법은 매 번 addition(base+offset)과 comparison(limit을 넘지 않는가?)을 해야하는 단점이 있다.
세계 최초의 supercomputer인 CDC 6600이 이 방법을 사용하였고, IBM PC에 사용된 Intel 8088 CPU는 base reg만 사용하였다.

[4.2 SWAPPING]
여러 프로그램이 실행되고 있는데 메모리가 모자랄 때에는, appoach는 두 가지가 있다. : swapping(프로그램 전체를 메모리에 올렸다가 다시 전체를 디스크에 back), virtual memory(프로그램이 일부만 올라와 있어도 실행이 가능하게 한다.).

memory compaction : 여러번 swapping으로 메모리에 여러 hole이 생기면 현재 올라와 있는 모든 process들을 최대한 아래로 다 옮긴다. 그런데 cpu time을 너무 많이 잡아먹어서 잘 사용 안한다.

fixed size memory allocation의 문제점 : heap등의 사용으로 process가 grow하면, 문제가 된다. 다른 process를 swap out 해야하는데, swap 디스크가 다 차던지 하면, process는 wait 하거나 kill해야한다. (이런 overhead를 방지하기 위해, extra memory를 조금 더 할당.)
Posted by 스니
http://nescc.sourceforge.net/
http://www.tinyos.net/tinyos-1.x/doc/tutorial/
Posted by 스니