Operating Systems

1 view
Skip to first unread message

Mehmet TAMTÜRK

unread,
Oct 23, 2011, 3:28:40 PM10/23/11
to Kankiler-İAÜ
Gençler,
VMware kurulumu: http://www.mehmettamturk.com/blog/?p=259

VMware sistem ayarları: http://www.mehmettamturk.com/blog/?p=282
Yalnız burda bir fark var, easy install bizim işimize yaramıyor.. O
yüzden sanal disk seçtiğimiz yerde en alttaki "İşletim sistemini daha
sonra yükleyeceğim" seçeneğini seçip, daha sonra ayarlara girip cd-rom
seçme yerinde sanal diskinizi seçip, sistemi başlatırsanız daha doğru
bir kurulum olur.

Ubuntu Kurulumu: http://www.mehmettamturk.com/blog/?p=358

Bunları kurduktan sonra yapıcaklarınızı daha sonra ekliyeceğim..

Not: Reklamın iyisi kötüsü olmaz!! :)

Saygı, sevgi ve hürmetlerimle.. ;)

Mehmet TAMTÜRK

unread,
Dec 13, 2011, 3:27:30 AM12/13/11
to Kankiler-İAÜ
ls -l
-la --> Klasördeki dosyaları gösterir.

cd <klasorAdı> --> klasör içine girmek için

pico text1.txt --> text editörde text1.txt adında bir dosya açar ve
içini düzenlememizi sağlar. ctrl-o ile kaydet, ctrl-x ile çıkış
yaparız.
eğer ki dosya önceden oluşturulmuşsa
içeriğini değiştirmek için yine pico text1.txt yazarız.

cp text1.txt text2.txt --> text1 dosyasını text2 dosyasına
kopyalamamızı sağlar.
cp -i text1.txt text2.txt --> buda kopyalama işini yapar, -i :
information gibi bişey.
cat text2.txt --> text2 dosyasının içeriğini ekrana bas diyoruz.

mkdir <directoryName> --> yeni bir klasör oluşturmak için
rmdir <directoryName> --> bir klasörü silmek için kullanılır (dosya
boşsa)
rm -r <directoryName> --> bir klasörü silmek için kullanılır (dosya
doluysa)

cp -ir <oldFileName> <newFileName> --> dosya kopyalamak için
kullanılcak komut

ls -l --> (long list / lists the details of the files, such as
permissions) --> yazma izinlerini filan gösterir.

--------------------------------------------------------
CHMOD------------------------------------------------------------
r w x -> read write execute
u--- user --> ilk 3 sıra
g--- group --> 2. 3lü sıra
o--- other user -->3. 3lü sıra
a--- all users

+ --> add permission (izin ekleme)
- --> remove permission (izin silme)
= --> assign permission


-rwxrwxrwx 1 os3 os3 136 2011-12-13 09:09 text1.txt --> tüm izinler
verilmiş dosya
-rw-r--r-- 1 os3 os3 56 2011-12-13 09:14 text2.txt --> user
için r,w (read,write) -- group için r -- diğer userlar için için -r
hakkı var.
-rw-r--r-- 1 os3 os3 56 2011-12-13 09:15 text3.txt

chmod --> dosya izinlerini düzenlemek için kullanılan komut.
chmod u-w text1.txt --> text1.txt dosyası için user dan yazma
izinlerini siliyoruz. Bu işlemden sonra text1.txt dosyasını
düzenleyemeyeceğiz.

Mehmet TAMTÜRK

unread,
Dec 14, 2011, 7:46:53 AM12/14/11
to Kankiler-İAÜ
Unix Commands Dos Commands:
-ls dir
-cd cd
-mkdir mkdir (md)
-rmdir rmdir (rm)
-pwd chdir
-cp copy
-cp -r vcopy
-more more
-man Help <command>
-exit cls
-grep find
-diff <file> <file2> comp (compare two file)
-pico <filename> edit <filename>
vi \other editors
emac /
- mv
-echo <text> echo <text>
-date date, time
-history Doskey -h
-chmod attrib
-mv file file2(. gizli dosya için) Attrib th <file>
-ls -all dir /a
-hostname Hostname
-ping <adres> ping
-ifconfig ipconfig
-du Chdisk
du -s
du -bh
du /-bh|more
-fdisk Fdisk
-route Route print
-traceroute (trace:takip) Tracert (parametre ile)

Mehmet TAMTÜRK

unread,
Dec 20, 2011, 3:44:26 AM12/20/11
to Kankiler-İAÜ
ubuntu
win
29) cat (show contents of a file to user screen) 29)
Type
30) echo $PATH (prints the search path for executables) 30)Path
31)wall (broadcasting) -> userlara mesaj
tty -> shows the terminal you work on
Alt + F1 -> terminaller içinde gezmek için
alt + F2
-> wall << .... -> tüm userlara mesaj gönderir.

32) mesg -> ile msajlaşma açıkmı diye bakılır.
is n ya is y
mesg y ile mesajlaşma açılır
mesg n ile kapanır.

33) talk --> apt-get install talk
talk d->daemon (a computer program that runs as a background process)
talk os3@<ip_address>

34)cat /etc/inetd.conf --> manages internet services
cd /etc , ls

35)same important characters
pipe (directs the output of the first command to the input of mother)
sends the output of a command to a designed tile
ls -l | more -> lists your luts in filer in long format one screen at
a time.

Mehmet TAMTÜRK

unread,
Dec 21, 2011, 7:38:03 AM12/21/11
to Kankiler-İAÜ
|
> => bu işaretten önce yazdıklarımızı işaretten sonra yazdığımız klasöre yazdırır.
>>
< = designates input from somewhere than terminal

ls -n > process.txt => list all the processes in a file.

Wildcard Characters
- * => ls *.txt --> any string of characters
- ? => ls text?.txt --> tüm text ile başlayan txt dosyalarını ekrana
basar.
- [] => match any character in the brachlets --> ls v[6-9]file -->
v6file, v7file, v8file, v9file

How to write shell scripts?
- Any editor like pico, vi
- After writing shell scripts we should set execute permission to the
script:
chmod permission scriptname
$chmod tx myscript
chmod 755

User(owner) 7 (rwx)
Group 5 (r_x)
Other 5 (r_x)

* echo $SHELL --> çalıştığın shell in adını gösterir.
* cat /etc/shells --> sistemdeki tüm shelleri gösterir.

To run a shell script:
./myscript
bash myscript


--------------------------------------------
Create Shell Script:
pico myScript

#
#My First Script
#
clear
echo "My first shell script"

--> chmod 755 myscript

--> ./myScript
veya
--> bash myScript

Sisteme login olan kullanıcı bilgilerini ve zamanı gösteren script:
#My Script
clear
echo "Hello $USER"
echo "Today is \c";date
echo "Number of users login :";who|wc -l
echo "calendar:"
cal
exit 0

Mehmet TAMTÜRK

unread,
Dec 28, 2011, 7:35:23 AM12/28/11
to Kankiler-İAÜ
To Avoid Race Condition ==>
-Busy Waiting
-Sleep & WakeUp --> sleep(), wakeup()
-Semaphores --> hw & sw support -dissabling interrupts, - If more
than one processor with TSL instr. semaphore should be protected.
-Mutexes --> down() //SLEEP , up() // WAKEUP;
-Message Passing
-Barriers

-------------------------------------------------------
typedef int semaphore;
semaphore mutex = 1; //Controls entrance to CR
semaphore empty = N;
semaphore full = 0;

//Producer
down(&empty);
down(&mutex); // --> enters CR

//Consumer
up(&mutex); // leave critical region
up(&empty);

****A problem Situation Using Semaphores***
*-Suppose that these statements are reversed in order.
*-Thus, mutex is decremented before empty is decremented.
*-If the buffer was completely full, the producer would block with
mutex set to .
*-When the consumer next tries to access the buffer, it would do down
on mutex, and sees ,t 0, and blocked too.
*-Both will be blocked forever. (deadlocks)
*****************************************************

-Suppose s as a semaphore:
down(s) {
if(s>0) s=s-1;
else waits_at_semaphore(); //sleep
}
up(s) {
if(waits_at_semaphore) { //activate the next process }
else s=s+1;
}

***Mutex (Binary Semaphores)***
-It is a variable having one of 2 states:
i) locked (1)
ii) unlocked (0)

Mutex :
-A global variable in PCB(Process Control Block).
-It is a variable in order to avoid deadlocks(işlemler düğümü) among
threads.
-When a thread(or process) needs access to a CR, it calls mutex_lock.
-If the mutex is unlocked, the the CR is available.
-If the mutex is really locked, the calling thread is blocked, until
the thread in CR is finished and calls "mutex_unlocked".
-In our example of "The producer & consumer problem using semaphores"
the mutex semaphore is used for mutual exclusion. It is designed to
guarantee that only one process at a time will be reading or writing
the buffer & the associated variables.
-Mutexes, can be implemented in user space, if a TSL instruction is
available.
-The code for "mutex_lock" and "mutex_unlock" for use with user level
threads package.

mutex_lock:
TSL REGISTER, MUTEX // copy mutex to register and set mutex to 1
CMP REGISTER, #0 // was mutex zero
JZE ok // if it was zero, mutex was
unlocked so return.
CALL thread_yield // mutex is busy, schedule another
thread.
JMP mutex_lock // ...try again later...
ok: RET // return to caller..

mutex_unlock:
MOVE MUTEX,#0 // store 0 in mutex
RET // return to caller

*******************************************
-Monitors
-Message Passing
-Barriers

Monitors:
-A monitor is a collection of:
- procedures (functions methods)
- variables
- data structures
-Implemented by programming language
constructors(parser,compiler,builder,linker)
- Parser knows monitors are special.
- Can handle monitor calls different from other procedure calls
When a process calls a monitor procedure
- check to see if there is any other process active within the
monitor
- If so, suspend the procedure until monitor will be available.
(other process left the monitor)
(Pidgin Pascal)
monitor example
integer i;
condition c;
procedure producer();
...
end;
procedure consumer();
...
end;
end monitor;

Mehmet TAMTÜRK

unread,
Jan 3, 2012, 3:29:18 AM1/3/12
to Kankiler-İAÜ
Message Passing
- Has two system calls,
send(destination, &message) // sends a message to a given
destination
receive(source, &messege) // receives a message from a given
source
-Message passing used in order to send and receive information among
processes (to achive interprocess communication(IPC))
-receive : if a message is not available, the process is blocked until
the message comes & a failure code is returned.

1) If the communicating processes are on different machines connected
by a network.
Messages can be lost by the network.
To guard against lost messages the receiver can agree that as soos
as a message has been received, the receiver will send back a sprecial
"acknowledgement" message.
If the sender has not received the acknowledgement within a
certain time interval, it retransmits message.
2) If the acknowledgement is lost(Infact the receiver received the
message)
The sender will retransmit the message, so the receiver will get.
This problem is solved by putting consecutive sequence number in
each original message.
If the receiver gets the same sequence numbers as te previous
message it knows that the message is duplicate that can be ignored.
3)Authentication can be also a problem.
Reply all
Reply to author
Forward
0 new messages