SlideShare a Scribd company logo
1 of 5
LINUX SYSTEM PROGRAMMING
20103366
이동우
성능측정(1차과제)
1번째 시도 2번째 시도 3번째 시도 4번째 시도 5번째 시도 평균
시간 55.864585 66.269756 65.854067 64.321649 62.059332 62.873877
8
File 1 Lines 2096962 2096962 2096962 2096962 2096962 2096962
File 2 Lines 2097147 2097147 2097147 2097147 2097147 2097147
Fout
lines
4194109 4194109 4194109 4194109 4194109 4194109
과제 성능측정(수정된코드)
1번째 시도 2번째 시
도
3번째 시
도
4번째 시
도
5번째 시
도
평균
시간 39.816586 34.274101 35.649551 36.103580 36.533464 36.475464
File 1
Lines
2097368 2097368 2097368 2097368 2097368 2097368
File 2
Lines
2096996 2096996 2096996 2096996 2096996 2096996
Fout
lines
4194364 4194364 4194364 4194364 4194364 4194364
성능 향상 요인
• 원래 있던 소스보다 40초 가량 줄어든 것을 확인 할 수 있다.
• Fgetc와 fputc가 가장 시간이 소요되는 부분이어서 그 부분을 바꿔주고자
fread를 사용하였다. 파일에 써주는 부분에서 먼저 fputs를 써주었는데 시
간이 단축되지 않아 fwrite를 써주었다.
• Fread (한 라인 크기의 버퍼에 입력받고 출력파일에 출력해주는 함수) 로
원하는 사이즈 만큼 읽어서 BUFF_SIZE보다 작으면 거꾸로 출력하고 크면
fseek()을 통해 파일의 포인터를 끝으로 옮긴 다음 잘린 부분 나머지를 읽
어서 붙여주려고 했다.
• gcc 컴파일러는 –O3로 최적화 해주는 옵션이 있는데 gcc –O3 –o merge
merge.c 명령어로 컴파일을 해주었다.
시도해보았지만 실패한 것들
• 성능은 향상 되었지만 결과 값이 이상하게 나왔다. 두줄이 연달아 붙어서
나오게 되었다.
• Mmap을 시도해보았지만 여전히 실패하였다.
• 원래 string을 입력하였을땐 제대로 나왔지만 reverse 해주는 순간 결과가
이상해졌다. 코드를 계속 수정하려했지만 제자리 걸음이었다.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Linux 2차과제

  • 2. 성능측정(1차과제) 1번째 시도 2번째 시도 3번째 시도 4번째 시도 5번째 시도 평균 시간 55.864585 66.269756 65.854067 64.321649 62.059332 62.873877 8 File 1 Lines 2096962 2096962 2096962 2096962 2096962 2096962 File 2 Lines 2097147 2097147 2097147 2097147 2097147 2097147 Fout lines 4194109 4194109 4194109 4194109 4194109 4194109
  • 3. 과제 성능측정(수정된코드) 1번째 시도 2번째 시 도 3번째 시 도 4번째 시 도 5번째 시 도 평균 시간 39.816586 34.274101 35.649551 36.103580 36.533464 36.475464 File 1 Lines 2097368 2097368 2097368 2097368 2097368 2097368 File 2 Lines 2096996 2096996 2096996 2096996 2096996 2096996 Fout lines 4194364 4194364 4194364 4194364 4194364 4194364
  • 4. 성능 향상 요인 • 원래 있던 소스보다 40초 가량 줄어든 것을 확인 할 수 있다. • Fgetc와 fputc가 가장 시간이 소요되는 부분이어서 그 부분을 바꿔주고자 fread를 사용하였다. 파일에 써주는 부분에서 먼저 fputs를 써주었는데 시 간이 단축되지 않아 fwrite를 써주었다. • Fread (한 라인 크기의 버퍼에 입력받고 출력파일에 출력해주는 함수) 로 원하는 사이즈 만큼 읽어서 BUFF_SIZE보다 작으면 거꾸로 출력하고 크면 fseek()을 통해 파일의 포인터를 끝으로 옮긴 다음 잘린 부분 나머지를 읽 어서 붙여주려고 했다. • gcc 컴파일러는 –O3로 최적화 해주는 옵션이 있는데 gcc –O3 –o merge merge.c 명령어로 컴파일을 해주었다.
  • 5. 시도해보았지만 실패한 것들 • 성능은 향상 되었지만 결과 값이 이상하게 나왔다. 두줄이 연달아 붙어서 나오게 되었다. • Mmap을 시도해보았지만 여전히 실패하였다. • 원래 string을 입력하였을땐 제대로 나왔지만 reverse 해주는 순간 결과가 이상해졌다. 코드를 계속 수정하려했지만 제자리 걸음이었다.