CENG/BILM 341 FINAL REVIEW. Dr. Esma Yıldırım



Benzer belgeler
YZM 3102 İşletim Sistemleri Uygulama

HTML 4. Bölüm. Doç. Dr. İsmail Rakıp Karaş Dersin Course Page:

YZM 3102 İşletim Sistemleri

BBM Discrete Structures: Final Exam Date: , Time: 15:00-17:00

Prosesler Arası Haberleşme ve Senkronizasyon

g Na2HPO4.12H2O alınır, 500mL lik balonjojede hacim tamamlanır.

Week 6: Bağlı Liste (Linked List) BAĞLI LİSTE KAVRAMI TEKİL (SINGLE) BAĞLI LİSTE ÇİFT (DOUBLE) BAĞLI LİSTE DAİRESEL (CIRCULAR) BAĞLI LİSTE

#include <stdio.h> int main(void) { FILE * dosya; dosya = fopen("soru1.txt", "w"); fprintf(dosya, "Merhaba Dunya!"); fclose(dosya); return 0; }

00322 ELECTRICAL MACHINES-II Midterm Exam

Lesson 64: Modal verbs Ders 64: Yardımcı fiiler

ÖRNEKTİR - SAMPLE. RCSummer Ön Kayıt Formu Örneği - Sample Pre-Registration Form

YEDİTEPE ÜNİVERSİTESİ MÜHENDİSLİK VE MİMARLIK FAKÜLTESİ

PC is updated PS güncellenir

YEDİTEPE ÜNİVERSİTESİ MÜHENDİSLİK VE MİMARLIK FAKÜLTESİ

Lesson 31: Interrogative form of Will. Ders 31: Will kalıbının soru biçimi

Disk Çizelgeleme. BTEP205 - İşletim Sistemleri

Ardunio ve Bluetooth ile RC araba kontrolü

Final Sınavı Soruları Bahar 2018

şeklinde tanımlanmıştır. O halde, dosyaları daha önceki bilgilerimizi kullanarak FILE *Dosya1, *Dosya2;

İş Parçacıkları (Threads)

Immigration Bank. Bank - General. Bank - Opening a bank account

Do not open the exam until you are told that you may begin.

İşletim Sistemleri. Hazırlayan: M. Ali Akcayol Gazi Üniversitesi Bilgisayar Mühendisliği Bölümü

Bölüm 5: Süreç Senkronizasyonu

Exercise 2 Dialogue(Diyalog)

Alıştırmalar 2 - Dağıtık Sistemler. Alıştırma 2. Prof. Dr. Th. Letschert Çeviri: Turgay Akbaş FB MNI 16. Mai 2013

Dağıtık Sistemler CS5001

Cases in the Turkish Language

C için tümleşik geliştirme ortamı (IDE) kurulumları

BTP 205 İŞLETİM SİSTEMLERİ

CSE225 DATA STRUCTURES 2006 Student Name: MIDTERM EXAM II M.B.T. Student Number:

Mart Ayı Değerler Eğitimi. Samimiyet

Mifare Kart Yazıcı/Okuyucu Modül (MFM-200)

Present continous tense

Dağıtık Sistemler CS5001


AB surecinde Turkiyede Ozel Guvenlik Hizmetleri Yapisi ve Uyum Sorunlari (Turkish Edition)

Veri Yapıları ve Algoritmalar dönem

İşletim Sistemlerine Giriş

Bölüm 6. Diziler (arrays) Temel kavramlar Tek boyutlu diziler Çok boyutlu diziler

DOS KOMUTLARI (DOS COMMANDS)

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU İNGİLİZCE SEVİYE TESPİT SINAVI KILAVUZU.

BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING)

Dairesel grafik (veya dilimli pie chart circle graph diyagram, sektor grafiği) (İngilizce:"pie chart"), istatistik

1 I S L U Y G U L A M A L I İ K T İ S A T _ U Y G U L A M A ( 5 ) _ 3 0 K a s ı m

Hesap bilgilerinizi b7project yolu ile aldığınıza emin olun. Bu kılavuzu takip ederek b7project render çiftliğine bağlanın. Connection Intructions

[ülke] sınırları içinde para çekersem komisyon ücreti öder miyim? Belirli bir ülkede para çekmenin komisyon ücretine tabi olup olmadığını sormak

Can I withdraw money in [country] without paying fees? Belirli bir ülkede para çekmenin komisyon ücretine tabi olup olmadığını sormak

TEMPLATES. Binnur Kurt Bilgisayar Mühendisliği Bölümü İstanbul Teknik Üniversitesi. C++ ile Nesneye Dayalı Programlama 1

TURKISH DIAGNOSTIC TEST TURKISH DEPARTMENT

Seri kablo bağlantısında Windows95/98/ME'ten Windows 2000'e bağlantı Windows95/98/ME - NT4 bağlantısına çok benzer.

a, ı ı o, u u e, i i ö, ü ü

IDENTITY MANAGEMENT FOR EXTERNAL USERS

Fiziksel Veritabanı Modelleme

Dosya Saklama Ortamları (Sabit Diskler) Kütük Organizasyonu 1

Background (Arka Plan)

Week 5 Examples and Analysis of Algorithms

BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING)

Lesson 18 : Do..., Don t do... Ders 18: yap, yapma

DÖNGÜLER (LOOPS) while(), do-while(), for(), foreach()

Unlike analytical solutions, numerical methods have an error range. In addition to this

Multicore/Multithread Programlama

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU İNGİLİZCE SEVİYE TESPİT SINAVI KILAVUZU.

Microsoft Office Macro Analysis

"Farklı?-Evrensel Dünyada Kendi Kimliğimizi Oluşturma" İsimli Comenius Projesi Kapsamında Yapılan Anket Çalışma Sonuçları.

İş Parçacıkları Thread(s)

Yarışma Sınavı A ) 60 B ) 80 C ) 90 D ) 110 E ) 120. A ) 4(x + 2) B ) 2(x + 4) C ) 2 + ( x + 4) D ) 2 x + 4 E ) x + 4

Questions for Turkish Experts re: Barış Pehlivan s Odatv Computer

e-ledger Fields (e-defter Alanları)

AHMET YESEVİ ÜNİVERSİTESİ BİLİŞİM SİSTEMLERİ VE MÜHENDİSLİK FAKÜLTESİ BİLGİSAYAR MÜHENDİSLİĞİ LİSANS DÖNEM ÖDEVİ

NEY METODU SAYFA 082 NEY METHOD PAGE 082. well.

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU

License. Veri Tabanı Sistemleri. Konular. Hareket Özellikleri. Tanım hareket: bir işin mantıksal bir birimi

HIGH SPEED PVC DOOR INSTALLATION BOOK

BBC English in Daily Life

YZM 2116 Veri Yapıları

Bölüm 7: Kilitlenme (Deadlocks)

Final Sınavı Örnek Soruları Bahar 2018

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU

Squid i Follow X-Forwarded-For headers Yaması İle Patchlemek

BBM Discrete Structures: Midterm 2 Date: , Time: 16:00-17:30. Question: Total Points: Score:

ve Senkronizasyon Senkronizasyon Eş Zamanlılık Sorunlar Sorunlar Çözüm Örnek

BİLGİSAYAR PROGRAMLAMA. Algoritma ve Akış Şemaları

CmpE 320 Spring 2008 Project #2 Evaluation Criteria

BİL 423 Bilgisayar Mimarisi 1. Ara Sınavı

Eastern Mediterranean University Faculty of Arts & Sciences -- Department Of Mathematics BİLG213 BİLGİSAYAR PROGRAMLAMAYA GİRİŞ

BMH-303 Nesneye Yönelik Programlama

Grade 8 / SBS PRACTICE TEST Test Number 9 SBS PRACTICE TEST 9

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU İNGİLİZCE SEVİYE TESPİT SINAVI KILAVUZU.

İngilizce konu anlatımlarının devamı burada Tıkla! Spot On 8 Ders Kitabı Tüm Kelimeleri. How do we spell the Present Continuous Tense?

1. Giriş HU-GO Web sayfası kullanıcı yüzeyinde kaydolma. Güverte Aracı (OBU) kayıt süreci. İçindekiler

Immigration Studying. Studying - University. Stating that you want to enroll. Stating that you want to apply for a course.

BİLKENT ÜNİVERSİTESİ İNGİLİZ DİLİ MESLEK YÜKSEKOKULU

ELEKTRONİK ALTERNATİF YAKIT SİSTEMLERİ SAN TİC LTD ŞTİ KE 013-B BENZİN SİMULATÖR ( B TİPİ ) PETROL TANK SIMULATOR ( B TYPE )

ATILIM UNIVERSITY Department of Computer Engineering

İşletim Sistemleri-II

Website review dersbook.com

mod ile açılacak olan dosyanın ne amaçla açılacağı belirlenir. Bunlar:

Görsel Programlama DERS 11. Görsel Programlama - Ders11/ 1

.. ÜNİVERSİTESİ UNIVERSITY ÖĞRENCİ NİHAİ RAPORU STUDENT FINAL REPORT

Transkript:

CENG/BILM 341 FINAL REVIEW Dr. Esma Yıldırım

Ques@on 1 Ques@on: An array of threads are working for filling and emptying a buffer that can hold mul@ple elements. There are two types of threads in the system. The P type is responsible for filling up the buffer while the C type is emptying it. If the buffer is full P threads have to wait and if it is empty C threads have to wait. The code implemented with semaphores for both types of threads are given below. What are the possible problems in the code? How should we update it to make it correct?(birden fazla eleman tutabilen bir bufferı doldurmak ve boşaltmak için birden fazla thread çalışmaktadır. Sistemde iki @p thread vardır. P @pi bufferı doldurmak ile görevli iken, C @p threadler boşaltmakla görevlidir. Eğer buffer dolu ise P threadleri yer boşalana kadar beklemeli boş ise C threadleri eleman olana kadar beklemelidir. Her iki thread @pi için kod semaforlar ile yazılmış olup aşağıdaki gibi verilmiş@r. Oluşabilecek problemler nelerdir ve nasıl kod doğru çalışabilir hale gelebilir ) P C Wait(S); while(temp!=- 1) Put(); Wait(S); Post(S); temp = Get(); Post(S);

Answer Threads can never understand if the buffer is empty or full. (Threadler bufferın boş yada dolu olduğunu anlayamazlar) P Wait(empty) Wait(S); Put(); Post(S); Post(Full) C while(temp!=- 1) Wait(full); Wait(S); temp = Get(); Post(S); Post(Empty);

Ques@on 2 For a memory system that has physical memory of 100Frames, any memory allocator thread allocates 10Frames at a @me, how would you update your semaphore implementa@on. (100 çerçevelik fiziksel hafzaya sahip olan bir hafza sisteminde hafzada yer ayırtmak için her seferinde 10 çerçeve istenmektedir. Buna göre semafor kodu nasıl değiş@rilmelidir)

typedef struct Sem_t { int value; pthread_cond_t cond; pthread_mutex_t lock; } Sem_t; // only one thread can call this void Sem_init(Sem_t *s, int value) { s- >value = value; Cond_init(&s- >cond); Mutex_init(&s- >lock); } void Sem_wait(Sem_t *s) { Mutex_lock(&s- >lock); while (s- >value <= 0) Cond_wait(&s- >cond, &s- >lock); s- >value- - ; Mutex_unlock(&s- >lock); } void Sem_post(Sem_t *s) { Mutex_lock(&s- >lock); s- >value++; Cond_signal(&s- >cond); Mutex_unlock(&s- >lock); } Ques@on 2 cont.

Answer Typedef struct{ int memorysize; int allocsize; pthread_cond_t cond; pthread_mutex_t lock; }Sem_t; void Sem_init(Sem_t *s, int value1,int value2){ s- >memorysize = value1; s- >allocsize = value2; Cond_init(&s- >cond); Mutex_init(&s- >lock); } void Sem_wait(Sem_t *s){ mutex_lock(&s- >lock); while(s- > memorysize < =0) Cond_wait(&s- >cond, &s- >lock); s- >memorysize - =s- >allocsize; mutex_unlock(&s- >lock); } void Sem_post(Sem_t *s){ mutex_lock(&s- >lock); s- >memorysize +=s- >allocsize; Cond_signal(&s- >cond); mutex_unlock(&s- >lock); }

Answer int main() { Sem_t *s; Sem_init(s,100,10); } void allocate(sem_t *s) { Sem_wait(s); } void deallocate(sem_t *s) { Sem_post(s); }

Ques@on 3 How else would you solve the deadlock problem in the Dining Philosophers Problem besides breaking the circular wait? What other problem other than deadlock could occur in this case? (Hint: Allow Preemp@on)(Yemekteki Filozoflar problemi dairesel beklemeyi kırma dışında nasıl çözülebilir? Bu çözümle başka ne gibi problemler ortaya çıkabilir?)

Answer Do{ pickuplerfork //sol çatalı al if(trypickuprightfork(l2)==- 1)//sağ çatalı almaya çalış putdownlerfork //sol çatalı bırak sleep for a while //uyu }while(true) Problem Livelock

Ques@on 4 Assume S, R and T are binary semaphores, and X, Y, Z are threads. (S,R,T binary semafor, X,Y,Z ise 3 adet threaddir) X consists of the following four statements(x threadi aşağıdaki 4 operasyondan oluşur): Post(S); Post(R);Post(T); Wait(T);Wait(R); Wait(S); Y consists of the following statements(y threadi aşağıdaki 4 operasyondan oluşur): Post(T); Post(S); Wait(T); Post(R); Wait(R); Wait (S); And, thread Z consists of the following statements(z threadi aşağıdaki 4 operasyondan oluşur): Post(R); Post(T); Post(S); Wait(R);Wait(S); Wait(T) Would it be safer to run X and Y together or to run X and Z together? Please jus@fy your answer.(x ve Y nin mi yoksa X ve Znin mi aynı anda çalışması daha güvenli olur)

Answer X and Y are safer because they lock the semaphores in the same order(x ve Y daha güvenlidir çünkü semaphorların kilitlenme sırası aynıdır.)

Ques@on 5 Rota@on speed : 1 msec per 1 degree (360degree in total) (dönme hızı 1ms de 1 derece- toplam 360 derece) 12 sectors per track (track başı 12 sektör) Head is on sector 6 (ilk olarak başlık 6. sektörde) Seek @me for transfer between tracks: 40msec (trackler arası arama süresi 40ms) Transfer @me from start of the sector to the end is 30 msec (rota@on @me per sector) (Transfer süresi sektör başı 30ms) For layout of the disk, run./disk.py G (disk şekli için./disk.py programını çalışyrın.) Calculate the rota@on, seek and transfer @mes for the following requests sector 7, 30, 8 for FIFO, SSTF, SPTF algorithms (Sektör 7,30,8 e olan istekler için FIFO, SSTF ve SPTF algoritmaları uygulanırsa arama, dönme ve transfer sürelerini hesaplayın)

Answer FIFO REQUESTS ['7', '30', '8'] Block: 7 Seek: 0 Rotate: 15 Transfer: 30 Total: 45 Block: 30 Seek: 80 Rotate:220 Transfer: 30 Total: 330 Block: 8 Seek: 80 Rotate:310 Transfer: 30 Total: 420 TOTALS Seek:160 Rotate:545 Transfer: 90 Total: 795 SSTF Block: 7 Seek: 0 Rotate: 15 Transfer: 30 Total: 45 Block: 8 Seek: 0 Rotate: 0 Transfer: 30 Total: 30 Block: 30 Seek: 80 Rotate:190 Transfer: 30 Total: 300 TOTALS Seek: 80 Rotate:205 Transfer: 90 Total: 375 SPTF Block: 7 Seek: 0 Rotate: 15 Transfer: 30 Total: 45 Block: 8 Seek: 0 Rotate: 0 Transfer: 30 Total: 30 Block: 30 Seek: 80 Rotate:190 Transfer: 30 Total: 300 TOTALS Seek: 80 Rotate:205 Transfer: 90 Total: 375

Ques@on 6 Draw the layout for the files consis@ng of 4, 12, 2, 8 blocks in a RAID Level 0 system with 6 disks and a chunk size of 2 blocks? (4, 12,2, ve 8 bloktan oluşan 4 dosya için 6 diskten oluşan ve grup büyüklüğü 2 blok olan RAID 0 sisteminde dosya bloklarının yerlerini gösteriniz)

Answer Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Disk 5 F1 (1) F1(3) F2(1) F2(3) F2(5) F2(7) F1(2) F1(4) F2(2) F2(4) F2(6) F2(8) F2(9) F2(11) F3(1) F4(1) F4(3) F4(5) F2(10) F2(12) F3(2) F4(2) F4(4) F4(6) F4(7) F4(8)

Ques@on 7 Write a command to change the name of the file X that resides in the root directory to Y inside the current working directory? Write the corresponding system call? (Root klasöründe yer alan X dosyasının adını o anki dizinde yer alan Y dosyasına çeviren komutu ve bu komutun çağırdığı sistem çağrısını yazın) Answer: mv /X./Y rename( /X,./Y );

Ques@on 8 How many reads/writes are necessary to open /X/Z/Y.txt?(inode+data block) (/X/Z/Y.txt dosyasını açmak için kaç tane okuma ve/veya yazma gereklidir?

Answer Read root inode Read root data Read X inode Read X data Read Z inode Read Z data Read Y.txt inode