SlideShare a Scribd company logo
1 of 10
고급 시스템 프로그래밍
과제 1 – Stage 2
두 파일을 하나의 파일로 합치기
line by line으로…
각 line을 뒤집어서…
국민대학교 컴퓨터공학부
20093319 이동규
수정 사항
(소스: https://github.com/ledgku/adv-sys-programming/blob/master/merge_reverse_final.c)
1. stat()을 fstat()으로 변경
2. malloc 예외처리 추가
3. merge할 파일에 사용한 fopen(), fclose(), fread()를 open(), close(),
read()로 변경
4. setvbuf() 사용하여 파일 출력 버퍼링 사용
5. strrev()의 xor 연산 방식에서 temp를 사용한 swap으로 변경
6. 최대 file merge size를 200MB로 변경
최종 결과 비교 – 100MB + 100MB
Template Stage 1 Stage 2
실행 시간 평균 130.276058 sec 46.400518 sec 34.7356 sec
성능
(최종 버전) / (Template)
. 0.356171 0.266631
수정 사항- stat()을 fstat()으로 변경
수정 사항- malloc 예외처리 추가
수정 사항- merge 할 파일에 open(), close(), read() 사용
수정 사항- setvbuf()를 사용한 파일 출력 버퍼링
수정 사항- strrev() 함수 변경, merge file max size를 200MB로 변경
시도만 한 것 - openmp
순서대로 두 파일의 라인을 merge하는 프로그램의 흐름상 반복문에서
#pragma omp for 적용은 불가능
strtok_r(…file1…)과 strtok_r(…file2…)에 #pragma omp section 적용
오히려 성능 저하
감사합니다.

More Related Content

What's hot

3D카툰메이커 완료세미나(복구됨)
3D카툰메이커 완료세미나(복구됨)3D카툰메이커 완료세미나(복구됨)
3D카툰메이커 완료세미나(복구됨)Daniel Shin
 
Binlog Servers 구축사례
Binlog Servers 구축사례Binlog Servers 구축사례
Binlog Servers 구축사례I Goo Lee
 
백업을 위한 USB운영체제 완료세미나
백업을 위한 USB운영체제 완료세미나백업을 위한 USB운영체제 완료세미나
백업을 위한 USB운영체제 완료세미나Daniel Shin
 
Lighting talk 2 12
Lighting talk 2 12Lighting talk 2 12
Lighting talk 2 12Kahee Yu
 
1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례I Goo Lee
 
Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part Isprdd
 

What's hot (7)

3D카툰메이커 완료세미나(복구됨)
3D카툰메이커 완료세미나(복구됨)3D카툰메이커 완료세미나(복구됨)
3D카툰메이커 완료세미나(복구됨)
 
About git
About gitAbout git
About git
 
Binlog Servers 구축사례
Binlog Servers 구축사례Binlog Servers 구축사례
Binlog Servers 구축사례
 
백업을 위한 USB운영체제 완료세미나
백업을 위한 USB운영체제 완료세미나백업을 위한 USB운영체제 완료세미나
백업을 위한 USB운영체제 완료세미나
 
Lighting talk 2 12
Lighting talk 2 12Lighting talk 2 12
Lighting talk 2 12
 
1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례1.mysql disk io 모니터링 및 분석사례
1.mysql disk io 모니터링 및 분석사례
 
Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part I
 

Viewers also liked

The journal exercise 2
The journal exercise 2The journal exercise 2
The journal exercise 2Caleb Soh
 
Herpes genitalis
Herpes genitalisHerpes genitalis
Herpes genitalisHerpes Cure
 
Enbe.project one 5.4.14
Enbe.project one 5.4.14Enbe.project one 5.4.14
Enbe.project one 5.4.14Caleb Soh
 
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...ᠯᠣᠪᠰᠠᠡ ᠯᠦᠦ
 
Learn how to become A Green thumb
 Learn how to become A Green thumb Learn how to become A Green thumb
Learn how to become A Green thumbNikelle Golden
 
Herpes zoster treatment
Herpes zoster treatmentHerpes zoster treatment
Herpes zoster treatmentHerpes Cure
 

Viewers also liked (12)

Herpes simplex
Herpes simplexHerpes simplex
Herpes simplex
 
The journal exercise 2
The journal exercise 2The journal exercise 2
The journal exercise 2
 
Herpes genitalis
Herpes genitalisHerpes genitalis
Herpes genitalis
 
Enbe.project one 5.4.14
Enbe.project one 5.4.14Enbe.project one 5.4.14
Enbe.project one 5.4.14
 
Herpes bucal
Herpes bucalHerpes bucal
Herpes bucal
 
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...
Мэргэжилтэй ажилтан бэлтгэх зорилгыг боловсролын үүрэг, зорилтын үүднээс авч ...
 
Learn how to become A Green thumb
 Learn how to become A Green thumb Learn how to become A Green thumb
Learn how to become A Green thumb
 
Herpes zoster treatment
Herpes zoster treatmentHerpes zoster treatment
Herpes zoster treatment
 
Herpes vaginal
Herpes vaginalHerpes vaginal
Herpes vaginal
 
Herpes pictures
Herpes picturesHerpes pictures
Herpes pictures
 
Herpes blisters
Herpes blistersHerpes blisters
Herpes blisters
 
Infografica
InfograficaInfografica
Infografica
 

Similar to Make fast file merge program using c (stage 2)

JVM_트러블슈팅.pdf
JVM_트러블슈팅.pdfJVM_트러블슈팅.pdf
JVM_트러블슈팅.pdfkwbak
 
Introduction to Parallel Programming
Introduction to Parallel ProgrammingIntroduction to Parallel Programming
Introduction to Parallel ProgrammingUNIST
 
고급시스템프로그래밍
고급시스템프로그래밍고급시스템프로그래밍
고급시스템프로그래밍CHANG-HYUN LEE
 
Adv sys prog_20123186_report1
Adv sys prog_20123186_report1Adv sys prog_20123186_report1
Adv sys prog_20123186_report1준석 김
 
리눅스 커널 기초 태스크관리
리눅스 커널 기초 태스크관리리눅스 커널 기초 태스크관리
리눅스 커널 기초 태스크관리Seungyong Lee
 
Git: A Motivating Introduction
Git: A Motivating IntroductionGit: A Motivating Introduction
Git: A Motivating IntroductionJongwook Choi
 
Linux 강의자료 ed10
Linux 강의자료 ed10Linux 강의자료 ed10
Linux 강의자료 ed10hungrok
 

Similar to Make fast file merge program using c (stage 2) (8)

JVM_트러블슈팅.pdf
JVM_트러블슈팅.pdfJVM_트러블슈팅.pdf
JVM_트러블슈팅.pdf
 
Introduction to Parallel Programming
Introduction to Parallel ProgrammingIntroduction to Parallel Programming
Introduction to Parallel Programming
 
Merge reversed2
Merge reversed2Merge reversed2
Merge reversed2
 
고급시스템프로그래밍
고급시스템프로그래밍고급시스템프로그래밍
고급시스템프로그래밍
 
Adv sys prog_20123186_report1
Adv sys prog_20123186_report1Adv sys prog_20123186_report1
Adv sys prog_20123186_report1
 
리눅스 커널 기초 태스크관리
리눅스 커널 기초 태스크관리리눅스 커널 기초 태스크관리
리눅스 커널 기초 태스크관리
 
Git: A Motivating Introduction
Git: A Motivating IntroductionGit: A Motivating Introduction
Git: A Motivating Introduction
 
Linux 강의자료 ed10
Linux 강의자료 ed10Linux 강의자료 ed10
Linux 강의자료 ed10
 

Make fast file merge program using c (stage 2)