#include #include #include "timers.h" #define N 1000 int main(int argc, char** argv) { int i,s,chunk; int a[N]; char prompt[][10] = {"static","dynamic","guided"}; if(argc < 2) return 0; s = atoi(argv[1]); chunk = atoi(argv[2]); timer_start(1); if(s == 0) { #pragma omp parallel for num_threads(10) schedule(static, chunk) for(i = 0; i < N ; i++) { int sum = 0, j; for(j = 0; j < i ; j++) { a[i] += ..
#include #include #include #include #include "timers.h" #define NDIM 1024 double a[NDIM][NDIM]; double b[NDIM][NDIM]; double c[NDIM][NDIM]; void matrix_multiply(double a[NDIM][NDIM], double b[NDIM][NDIM], double c[NDIM][NDIM], int num_threads) { int i; omp_set_num_threads(num_threads); #pragma omp parallel { int i,j,k; int tid = omp_get_thread_num(); int from = (NDIM * tid) / num_threads; int to..
#include #include #include #include "timers.h" #include #include #define MAX_THREADS 32 #define NDIM 100000 typedef struct { int *data; int from; int to; int *max; } thread_args; int num_threads = 0; void* worker(void* arg) { thread_args* args = (thread_args*) arg; int from = args->from; int to = args->to; int *ret = args->max; int *data = args->data; int max = 0; int i; for(i = from ; i < to ; ..
vnc viewer를 이용하여 작업을 하려고 했는데!!터미널 한개만 보이고! 움직이지도 않는다! 왜 그런걸까? 고심하던 찰나에 열심히 찾아보았다.답은 간단하였다. tvm을 설치하지 않았기 때문이다. 일단, 터미널 창에서 다음의 명령어를 적고 엔터키를 누른다.yum install xorg-x11-twmtwm 설치가 완료 되었으면 실행시킨다. twm & 혹은 twm twm를 실행시키면 짜자잔! 만약에 그 전 단계인 X-window가 설치가 안되어있다면 맨 위와 같은 화면이 나오지 않을 것이다. (정확하지는 않음)그럴 경우 명령어를 사용해서 설치해주자.yum install xterm 궁금한 사항은 댓글 'ㅁ'!구글에서 vnc 설치 관련해서 검색하면 많이 나오는데 twm 관련해서는 한국어사이트가 별로 없더라. ..
쉘스크립트를 이용해 mkdir를 편하게 사용해보자동일한 형태의 작업을 해야할때 쉘스크립트는 유용하게 사용할 수 있다.$1은 첫번째 인자, $2는 두번째 인자를 가리킨다.expr을 사용해 숫자로 인식했고 -lt를 사용했기 때문에 +1를 해주었다. [소스코드] count=`expr $1` count2=`expr $2 + 1` word='' while [ $count -lt $count2 ] do if [ $count -lt 10 ] then word='day0'$count echo "make folder : $word" else word='day'$count echo "make folder : $word" fi mkdir -p ./$word count=`expr $count + 1` done echo '==..
이번 과제는 원하는 만큼 구구단 출력하기!!!!아래 그림과 같다.급하게 만들어서 약간의 오류가 있다. 알아서 수정하길 바란다. // This source was written by Yo-han Kim (johnkim126@korea.ac.kr) // Title : Print a multiplication Table with command line argument (Programming Assignment on Operating System, Korea Univ.) #include #include #include #include int main(int argc, char** argv){ /*- variables definition and initialization - int i : print row int..
프로그램 카운터 과제는 1초마다 프로세스 수를 표시한다.EnumProcess 함수를 통해 프로세스의 수를 구하면 된다. print_less_ten은 내가 개인적으로 만든 함수이다. 날짜 표시할 때 10이하면 두자리수를 맞춰주지 못하기 때문에 그러한 경우 '0'을 출력하도록 하였다. #pragma comment( lib, "Psapi.lib" ) #include #include #include #include #include #include using namespace std; void print_less_ten(int n){ // change print style for right format if(n