πŸ”₯[Pintos][Project 2][2023.06.02~2023.06.11]Team WIL

PyotatoΒ·2023λ…„ 6μ›” 1일
0
post-thumbnail

🀫읡λͺ…μ„± 보μž₯을 μœ„ν•΄ νŒ€μ› 1,2,3으둜 ν‘œκΈ°ν–ˆμŠ΅λ‹ˆλ‹€.
πŸ–οΈμ €λŠ” νŒ€μ›3μž…λ‹ˆλ‹€.

πŸ“‘κ²°κ³Ό

95 개 쀑 1개fail

πŸŽ―μ§„ν–‰

testtrial 4 (1/95)trial 3 (18/95)trial 2 (19/95)trial 1 (18/95)
tests/threads/priority-donate-chainβ­•β­•β­•β­•
tests/userprog/args-noneβ­•β­•β­•β­•
tests/userprog/args-singleβ­•β­•β­•β­•
tests/userprog/args-multipleβ­•β­•β­•β­•
tests/userprog/args-manyβ­•β­•β­•β­•
tests/userprog/args-dbl-spaceβ­•β­•β­•β­•
tests/userprog/haltβ­•β­•β­•β­•
tests/userprog/exitβ­•β­•β­•β­•
tests/userprog/create-normalβ­•β­•β­•β­•
tests/userprog/create-emptyβ­•β­•β­•β­•
tests/userprog/create-nullβ­•βŒβŒβ­•
tests/userprog/create-bad-ptrβ­•βŒβŒβ­•
tests/userprog/create-longβ­•β­•β­•β­•
tests/userprog/create-existsβ­•β­•β­•β­•
tests/userprog/create-boundβ­•β­•β­•β­•
tests/userprog/open-normalβ­•β­•β­•β­•
tests/userprog/open-missingβ­•β­•β­•β­•
tests/userprog/open-boundaryβ­•β­•β­•β­•
tests/userprog/open-emptyβ­•β­•β­•β­•
tests/userprog/open-nullβ­•βŒβŒβ­•
tests/userprog/open-bad-ptrβ­•βŒβŒβ­•
tests/userprog/open-twiceβ­•β­•β­•β­•
tests/userprog/open-twiceβ­•β­•β­•β­•
tests/userprog/close-normalβ­•β­•β­•β­•
tests/userprog/close-twiceβ­•β­•β­•β­•
tests/userprog/close-bad-fdβ­•βŒβŒβ­•
tests/userprog/read-normalβ­•β­•β­•β­•
tests/userprog/read-bad-ptrβ­•βŒβŒβ­•
tests/userprog/read-boundaryβ­•β­•β­•β­•
tests/userprog/read-zeroβ­•β­•β­•β­•
tests/userprog/read-stdoutβ­•β­•β­•β­•
tests/userprog/read-bad-fdβ­•βŒβŒβ­•
tests/userprog/write-normalβ­•β­•β­•β­•
tests/userprog/write-bad-ptrβ­•β­•βŒβ­•
tests/userprog/write-boundaryβ­•β­•β­•β­•
tests/userprog/write-zeroβ­•β­•β­•β­•
tests/userprog/write-stdinβ­•βŒβŒβ­•
tests/userprog/write-bad-fdβ­•βŒβŒβ­•
tests/userprog/fork-onceβ­•β­•β­•βŒ
tests/userprog/fork-recursiveβ­•β­•β­•βŒ
tests/userprog/fork-readβ­•β­•β­•βŒ
tests/userprog/fork-closeβ­•β­•β­•βŒ
tests/userprog/fork-boundaryβ­•β­•β­•βŒ
tests/userprog/exec-onceβ­•β­•β­•βŒ
tests/userprog/exec-argβ­•β­•β­•βŒ
tests/userprog/exec-boundaryβ­•β­•β­•βŒ
tests/userprog/exec-missingβ­•βŒβŒβ­•
tests/userprog/exec-bad-ptrβ­•βŒβŒβ­•
tests/userprog/exec-readβ­•β­•β­•βŒ
tests/userprog/wait-simpleβ­•β­•β­•βŒ
tests/userprog/wait-twiceβ­•β­•β­•βŒ
tests/userprog/wait-killedβ­•β­•β­•βŒ
tests/userprog/wait-bad-pidβ­•β­•β­•β­•
tests/userprog/multi-recurseβ­•β­•β­•βŒ
tests/userprog/multi-child-fdβ­•β­•β­•βŒ
tests/userprog/rox-simpleβ­•β­•β­•β­•
tests/userprog/rox-childβ­•β­•β­•βŒ
tests/userprog/rox-multichildβ­•β­•β­•β­•
tests/userprog/bad-readβ­•βŒβŒβ­•
tests/userprog/bad-writeβ­•βŒβŒβ­•
tests/userprog/bad-read2β­•βŒβŒβ­•
tests/userprog/bad-write2β­•βŒβŒβ­•
tests/userprog/bad-jumpβ­•βŒβŒβ­•
tests/userprog/bad-jump2β­•βŒβŒβ­•
tests/filesys/base/lg-createβ­•β­•β­•β­•
tests/filesys/base/lg-fullβ­•β­•β­•β­•
tests/filesys/base/lg-randomβ­•β­•β­•β­•
tests/filesys/base/lg-seq-blockβ­•β­•β­•β­•
tests/filesys/base/lg-seq-randomβ­•β­•β­•β­•
tests/filesys/base/sm-createβ­•β­•β­•β­•
tests/filesys/base/sm-fullβ­•β­•β­•β­•
tests/filesys/base/sm-randomβ­•β­•β­•β­•
tests/filesys/base/sm-seq-blockβ­•β­•β­•β­•
tests/filesys/base/sm-seq-randomβ­•β­•β­•β­•
tests/filesys/base/syn-readβŒβ­•βŒβŒ
tests/filesys/base/syn-removeβ­•β­•β­•β­•
tests/filesys/base/syn-writeβ­•β­•β­•βŒ
tests/userprog/no-vm/multi-oomβ­•β­•β­•βŒ

πŸ“†κ³„νš

  • κΈ°κ°„ : 2023/06/02~2023/06/12

πŸ“μ§„ν–‰ 상황

* μ›ν™œν•œ μ†Œν†΅μ„ μœ„ν•΄ ν”„λ‘œμ νŠΈ 진행 저녁 8μ‹œμ— 일정 κ³΅μœ ν•˜μ—¬ 진행 상황 νŒŒμ•…ν•˜μ—¬ κΈ°λ‘ν–ˆμŠ΅λ‹ˆλ‹€.

λ‚ μ§œνŒ€μ› 1νŒ€μ› 2νŒ€μ› 3
2023.06.01alarm clock κ΅¬ν˜„κ°œλ°œν™˜κ²½ μ„ΈνŒ… (new branch)
2023.06.02alarm clock κ΅¬ν˜„gitbook userprog λΆ€λΆ„ 읽기 및 μ •λ¦¬ν•˜κΈ°
2023.06.03alarm clock κ΅¬ν˜„gitbook λ‚΄μš©μ •λ¦¬/해석 및 κ΄€λ ¨ 자료 쑰사
2023.06.04pintos μ‹€ν–‰ 흐름 정리
2023.06.05priority scheduling κ³΅λΆ€μš΄μ˜μ²΄μ œ 책읽기:1~3argument passing κ΅¬ν˜„
2023.06.06priority scheduling κ³΅λΆ€μš΄μ˜μ²΄μ œ 책읽기:4~7argument passing κ΅¬ν˜„
2023.06.07priority scheduling κ³΅λΆ€μš΄μ˜μ²΄μ œ 책읽기:8~10argument passing κ΅¬ν˜„
2023.06.08synchronization 곡뢀argument passing κ΅¬ν˜„μ‹œμž‘argument passing 디버깅 & process & thread switching κ°œλ…κ³΅λΆ€ 및 정리
2023.06.09user program 곡뢀argument passing μ™„λ£Œargument passing κ΅¬ν˜„ λ‚΄μš© 정리
2023.06.10user program 곡뢀system call κ΅¬ν˜„ 쀑argument passing 디버깅&syscall κ΅¬ν˜„μ‹œμž‘
2023.06.11system call κ΅¬ν˜„ 쀑syscall κ΅¬ν˜„ & 디버깅
2023.06.12system call κ΅¬ν˜„ 쀑syscall κ΅¬ν˜„ & λ””λ²„κΉ…βž‘οΈκ΅¬ν˜„ μ™„μ„±ν•˜κ³  λ‚΄μš© μ •λ¦¬ν•˜κΈ°

πŸ“‹μƒˆλ‘œ 배우게 된 λ‚΄μš©λ“€

  1. μ„Έλ§ˆν¬μ–΄ - ꡐ착 μƒνƒœ(dead lock)에 λŒ€ν•œ 해법 atomic operation
    μ‹μ‚¬ν•˜λŠ” μ² ν•™μž 문제
  1. μ‹œμŠ€ν…œ μ½œμ— λŒ€ν•΄μ„œ μƒˆλ‘­κ²Œ μ•Œκ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 컴퓨터 μ‹œμŠ€ν…œμ—μ„œ, μ‚¬μš©μž 레벨의 ν”„λ‘œμ„ΈμŠ€λŠ” 일반적으둜 ν•˜λ“œμ›¨μ–΄μ— μ§μ ‘μ μœΌλ‘œ μ ‘κ·Όν•  수 μ—†μŠ΅λ‹ˆλ‹€. μ΄λ ‡κ²Œ μ„€κ³„λœ μ΄μœ λŠ” μ•ˆμ •μ„±κ³Ό λ³΄μ•ˆμ„±μ„ μœ μ§€ν•˜κΈ° μœ„ν•œ κ²ƒμž…λ‹ˆλ‹€. ν•˜μ§€λ§Œ λ•Œλ•Œλ‘œ ν”„λ‘œμ„ΈμŠ€λŠ” ν•˜λ“œμ›¨μ–΄μ— μ ‘κ·Όν•΄μ•Ό ν•˜λŠ” κ²½μš°κ°€ λ°œμƒν•©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄μ„œ 파일 μ‹œμŠ€ν…œμ— μ ‘κ·Όν•˜κ±°λ‚˜ λ„€ν¬μ›Œν¬ 톡신을 ν•˜κ±°λ‚˜ ν•˜λ“œμ›¨μ–΄ μž₯치λ₯Ό μ œμ–΄ν•  ν•„μš”κ°€ μžˆλŠ” κ²½μš°μž…λ‹ˆλ‹€. 이럴 경우 μ‚¬μš©μž ν”„λ‘œμ„ΈμŠ€λŠ” μ‹œμŠ€ν…œ μ½œμ„ μ‚¬μš©ν•˜μ—¬ ν•„μš”ν•œ μ„œλΉ„μŠ€λ₯Ό μš”μ²­ν•©λ‹ˆλ‹€. μ‹œμŠ€ν…œ μ½œμ„ μ‚¬μš©ν•˜λ©΄, ν”„λ‘œμ„ΈμŠ€λŠ” μž μ‹œ 컀널λͺ¨λ“œλ‘œ μ „ν™˜λ˜λ©° 이 μƒνƒœμ—μ„œλŠ” ν•˜λ“œμ›¨μ–΄μ— 직겁 접근이 κ°€λŠ₯ν•˜κ²Œ λ©λ‹ˆλ‹€. 이 μž‘μ—…μ„ 운영 μ²΄μ œκ°€ μ œμ–΄ν•©λ‹ˆλ‹€.
  1. μ‹œμŠ€ν…œμ½œ, userκ³Ό kernel mode μƒνƒœλ₯Ό μ˜€κ°€λŠ” 흐름, 디버깅 툴 μ‚¬μš©λ²• ft.backtrace

πŸ€”μ–΄λ €μ› λ˜ 점

  • νŒ€μ› 1: 클둠 μ½”λ”© ν•˜μ§€ μ•Šκ³  ν•΄κ²°ν•˜κΈ° μœ„ν•΄ 디버깅에 μ‹œκ°„μ„ λ„ˆλ¬΄ 많이 μ‚¬μš©ν•œ 점

  • νŒ€μ› 2: 첫 μ£Όμžλ„ 맀우 μ–΄λ €μš΄ μ£Όμ°¨μ˜€μ§€λ§Œ 이번 μ£Όμ°¨λŠ” 더 νž˜λ“€μ—ˆλ˜ ν•œ μ£Όμ˜€μŠ΅λ‹ˆλ‹€. 일단 μ–΄λ–»κ²Œ 곡뢀해야 ν•˜λŠ” 지에 λŒ€ν•΄ λ°©ν–₯을 μ œλŒ€λ‘œ μž‘μ§€ λͺ»ν–ˆμŠ΅λ‹ˆλ‹€. κ°œλ… 곡뢀λ₯Ό μ§‘μ€‘μ μœΌλ‘œ ν•΄μ•Όν•˜λŠ” 것인지 주어진 ν€˜μŠ€νŠΈλ₯Ό 진행해야 ν•˜λŠ” 것인지 ν—€λ§€μ—ˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ 곡뢀λ₯Ό ν•˜μ˜€μŒμ—λ„ μ½”λ“œλ₯Ό 지 수 μ—†μ—ˆκ³  혼자 힘으둜 무언가λ₯Ό μ‹œλ„ν•˜λ €κ³  ν•˜λ €λŠ” μ˜μ§€κ°€ 많이 λΆ€μ‘±ν•΄μ‘Œλ˜ κ±° κ°™μŠ΅λ‹ˆλ‹€.

  • νŒ€μ› 3: μ½”λ“œμ˜ 양이 λ°©λŒ€ν•˜λ‹€λ³΄λ‹ˆ 전체적인 흐름을 μž‘λŠ”κ²Œ μ–΄λ €μ› μŠ΅λ‹ˆλ‹€. 항상 κ·Έλž˜μ„œ 이걸 μ™œ ν•΄μ£ΌλŠ” 거지?λ₯Ό μƒκ°ν•˜λŠ”λ°, μƒˆλ‘œμš΄ κ°œλ…λ“€κ³Ό λ°©λŒ€ν•œ μ½”λ“œλŸ‰ λ•Œλ¬Έμ—, 일단은 μ½”λ“œλ₯Ό λœ―μ–΄λ³΄μžν–ˆλ˜ 게 였히렀 더 제 질문의 λ‹΅κ³ΌλŠ” λ©€μ–΄μ§€κ²Œ ν–ˆλ˜ κ±° κ°™μ•„μ„œ κ°œλ…μ„ μž‘κΈ°λ„, μ½”λ“œλ₯Ό μ§œκΈ°μ—λ„ 어렀움이 μžˆμ—ˆμŠ΅λ‹ˆλ‹€. κ²Œλ‹€κ°€ ν•œμ–‘λŒ€ pptλž‘ μΉ΄μ΄μŠ€νŠΈλž‘ μ’€ λ‹¬λΌμ Έμ„œ ν—·κ°ˆλ¦Ό..

πŸ€— Solution

  1. πŸ€”

  2. 방법은 μ •ν•΄μ Έμžˆμ§€ μ•Šλ‹€λŠ” 것이 핡심인 κ±° κ°™μŠ΅λ‹ˆλ‹€. 정글은 말 κ·ΈλŒ€λ‘œ 살아남기 μœ„ν•΄ μˆ˜λ‹¨κ³Ό 방법을 가리면 μ•ˆλ˜κ² λ‹€λΌλŠ” 닀짐을 ν•˜κ²Œ 된 κ±° κ°™μŠ΅λ‹ˆλ‹€. λ‹€λ“€ ν—€λ©”κ³ μžˆμœΌλ©΄μ„œλ„ μ΅œμ„ μ„ λ‹€ν•΄μ„œ 길을 μ°Ύμ•„λ‚˜κ°€λ €λŠ” λͺ¨μŠ΅μ„ λ³΄λ©΄μ„œ κ·Έλž˜λ„ 일단 ν•΄λ³΄μžλΌλŠ” λ§ˆμŒμ„ 가지고 ν•΄μ•Όμ§€λΌλŠ” 생각이 λ“€μ—ˆμŠ΅λ‹ˆλ‹€.

  3. 일단 νŠΉκ°•μ„ λ“€μ—ˆμ„ λ•Œ 쑰금 λ°©ν–₯ 섀정에 도움이 λ˜μ—ˆλ˜ κ±° κ°™μŠ΅λ‹ˆλ‹€. μ½”λ“œλ₯Ό κ΅¬ν˜„ν•˜λ©΄μ„œ os에 λŒ€ν•œ κ°•μ˜λ“€λ„ μ°Έκ³ ν•΄μ„œ μ–΄λŠ 정도 흐름에 λŒ€ν•œ 이해λ₯Ό 가지고 λ‹€μ‹œ μ ‘κ·Όν•΄μ„œ project2μ—μ„œ κ΅¬ν˜„ν•˜κ³ μž ν•˜λŠ” 것(arg passing, system call)κ³Ό μ™œ 그것듀을 ν•΄μ€˜μ•Όν•˜λŠ” 지(ν˜„μž¬ input λ°›λŠ” λ°©μ‹μ˜ 문제, kernelκ³Ό userκ°„μ˜ μ΄λ™ν•˜κΈ° μœ„ν•΄ ν•„μš”ν•œ μˆ˜λ‹¨)κ°€ 훨씬 μ™€λ‹Ώμ•˜μŠ΅λ‹ˆλ‹€.


πŸ§‘β€πŸ’» μ½”λ“œ ν•œμ€„ μ†Œκ°œ

void test_max_priority (void){
	if(thread_current ()->priority < list_entry(list_max (&ready_list, cmp_priority, NULL), struct thread, elem)->priority){
		return thread_yield();
	if(!list_empty(&ready_list)){
		if(thread_get_priority() < list_entry(list_front(&ready_list), struct thread, elem)->priority ){
			return thread_yield();
		}
hex_dump(_if.rsp, _if.rsp, KERN_BASE - _if.rsp, true);
ν•΄λ‹Ή μ½”λ“œλ₯Ό μ†Œκ°œν•˜λŠ” μ΄μœ λŠ” argument parsing을 κ΅¬ν˜„ν•˜κ³  처음으둜 testλ₯Ό 돌렀보렀고 ν•˜λ‹€κ°€ μ˜ˆμ™Έ 처리λ₯Ό ν•˜μ§€ μ•Šμ•„μ„œ μž‘λ™μ΄ λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ν•˜μ—¬ ꡬ글링을 ν•˜λ©΄μ„œ ν•΄κ²° 방법을 μ°Ύμ•˜μŠ΅λ‹ˆλ‹€.
void
test_max_priority(void) {
    if(!intr_context() && !list_empty(&ready_list) && list_entry (list_front(&ready_list), struct thread, elem)->priority > thread_current()->priority)
        thread_yield();
}

μ €λ²ˆ 주에도 μ†Œκ°œν–ˆμ—ˆλ˜ μ½”λ“œμΈλ° λ‹€μ‹œ ν•œλ²ˆ μ˜ˆμ™Έ 처리λ₯Ό ν•˜κ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ¬Έμ œλŠ” thread_yieldν•¨μˆ˜μ—μ„œ μ™ΈλΆ€ ν”„λ‘œμ„ΈμŠ€μ™€ λ‚΄λΆ€ ν”„λ‘œμ„ΈμŠ€λ₯Ό κ΅¬λΆ„ν•˜μ§€ λͺ»ν•˜λŠ” λ¬Έμ œκ°€ λ°œμƒν•˜μ—¬ 잘 λͺ» ν˜ΈμΆœλ˜μ—ˆκ³  !intr_context() 이 뢀뢄을 μΆ”κ°€ν•˜μ—¬ λ‚΄λΆ€ μΈν„°λŸ½νŠΈκ°€ 처리 쀑 일 경우 trueλ₯Ό λ°˜ν™˜ μ‹œμΌœμ£Όμ–΄ μ˜ˆμ™Έ 처리λ₯Ό ν•΄μ€˜μ•Ό ν•œλ‹€λŠ” 것을 μ•Œκ²Œ λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

  • νŒ€μ› 3λ‹˜ :
    userμ—μ„œ kernel 또 kernelμ—μ„œ user둜 μ΄λ™ν•˜λŠ” μ½”λ“œμ˜ 흐름에 λŒ€ν•΄ κ°„λ‹¨νžˆ κ³΅μœ ν•˜κ³ μž ν•©λ‹ˆλ‹€.




🧐Project2 마감 μ†Œκ° & λŠλ‚€μ 

  • νŒ€μ› 1λ‹˜ : κ°œλ… 곡뢀 ν›„ μ½”λ“œλ₯Ό μž‘μ„±ν•΄λ³Έ λ‹€μŒ
    ν•˜λ£¨ 이틀 μ „μ—λŠ” 닡을 μ°Έμ‘°ν•΄μ„œ 완성을 ν•΄μ•Ό ν•˜λŠ”μ§€?
  • νŒ€μ› 2λ‹˜ : λ§ˆκ°μ„ ν•˜λ©΄μ„œ 느끼게 된 점은 μ •κΈ€μ΄λΌλŠ” 곳이 정말 νž˜λ“€κ³  고된 κ³³μ΄λΌλŠ” 것을 느끼게 된 μ‹œκ°„μ΄λΌλŠ” 것과 λ°©ν™©ν•  μ‹œκ°„μ‘°μ°¨ λΆ€μ‘±ν•˜λ‹€λŠ” κ³΅κ°„μ΄λΌλŠ” 것을 느끼게 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
  • νŒ€μ› 3λ‹˜ : μ½”λ“œλ₯Ό κ΅¬ν˜„ν•˜λ €λ‹€λ³΄λ©΄ 계속 λ‚˜λ¬΄λ₯Ό 보렀고 ν•˜λŠ” λŠλ‚ŒμΈλ° μ˜μ‹μ μœΌλ‘œ μˆ²μ„ λ³΄λŠ” μ—°μŠ΅μ„ ν•΄λ΄μ•Όκ² μŠ΅λ‹ˆλ‹€. (os 곡뢀λ₯Ό 톡해 흐름 작기)

βœοΈνŒ€μ›λ“€ ν•œμ€„ μ†Œκ°

profile
https://pyotato-dev.tistory.com/ 둜 이사쀑 πŸššπŸ’¨πŸš›πŸ’¨πŸššπŸ’¨

0개의 λŒ“κΈ€