Tuesday, November 18, 2014

Macam-macam fungsi yang ada pada pthread.h


  • pthread_t
pthread_t adalah fungsi data thread yang digunakan dalam deklarasi Variabel.

contoh: pthread_t thread1; -> membuat variabel thread1 berupa thread.

  • pthread_mutex_t
pthread_mutex_t adalah tipe data mutex thread yang digunakan dalam deklarasi variabel.

contoh: pthread_mutex_t lock; -> Membuat variabel mutex thread bernama lock.

  • pthread_create
pthread_create adalah sebuah fungsi yang digunakan untuk menciptakan thread baru dalam suatu proses dengan atribut yang ditentukan. Bila tidak di isi,maka akan diisi dengan atribut default.fungsi ini mempunyai 4 parameter.

contoh: pthread_create(&thread1,NULL,function,NULL);

  • pthread_detach
pthread_detach adalah fungsi yang digunakan untuk menandakan bahwa suatu thread telah di-detach.Thread yang detached bila di-eliminate/berakhir,Maka resourceyang digunakan akan diminta kembali ke sistem secara otomatis.

contoh: pthread_detach(thread1); ->menandakan bahwa thread1 di-detach.

  • pthread_cancel
pthread_cancel adalah fungsi yang digunakan untuk mengirim permintaan pembatalan pada suatu thread.Kapan terjadinya proses pembatalan tergantung pada atribut yang berada dalam kontrol thread tersebut.

contoh: pthread_cancel (thread1);

  • pthread_mutex_lock
pthread_mutex_lock adalah fungsi yang digunakan untuk mengunci sebuah mutex thread.Suatu mutex yang telah di-lock akan memblok pemanggilan thread sampai mutex tidak di-lock.

contoh: pthread_mutex_lock (&thread1); -> membuat mutex thread1 menjadi terkunci.

  • pthread_mutex_unlock
pthread_mutex_unlock adalah fungsi yang digunakan untuk melepas status lock pada sebuah mutex. Oleh karena itu,fungsi ini harus dipanggil terhadap suatu mutex yang sebelumnya sudah di-lock.

contoh:pthread_mutex_unlock(&thread1); ->membuat mutex thread1 menjadi terkunci.

  • pthread_mutex_destroy
pthread_mutex_destroy adalah fungsi yang digunakan untuk menghancurkan suatu mutex.Mutex yang dihancurkan tidak dapat diakses lagi dan seakan-akan tidak pernah diinisialisasi.

contoh: pthread_mutex_destroy(&thread1); -> akan menghancurkan thread1 yang sebelumnya sudah dideklarasi.


  • pthread_exit
pthread_exit adalah fungsi yang digunakan untuk menghentikan pemanggilan thread.Fungsi ini memiliki 1 parameter,yaitu return value yang bisa digunakan untuk thread lain dalam proses yang sama.

contoh: pthread_exit(*return_value);

  • pthread_join
pthread_join adalah fungsi untuk melakukan penggabungan dengan thread lain yang telah di-terminasi (telah di exit).Bila thread yang ingin di-join belum diterminasi,Maka fungsi ini akan menunggu hingga thread yang diinginkan telah terminated.

contoh:pthread_join(thread1,* return_value);

Wednesday, November 5, 2014

IPC : Semaphore

Perngertian dan fungsi dari semaphore
●Semaphore adalah sebuah variabel yang dilindungi atau tipe data abstrak yang digunakan untuk membatasi akses ke sumber daya bersama seperti shared memory dalam suatu lingkungan pemrograman paralel.
Semaphore biasanya digunakan untuk memonitor dan mengontrol ketersediaan system resource seperti dalam shared memory atau untuk menghindari terjadinya konkurensi.

Semget dan semctl digunakan untuk mengalokasikan dan membebaskan semaphore.

Contoh Implementasi Semaphore dalam bahasa pemograman C :

#include <semaphore.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>

int main(int argc, char **argv)
{
  int fd, i,count=0,nloop=10,zero=0,*ptr;
  sem_t mutex;

  fd = open("log.txt",O_RDWR|O_CREAT,S_IRWXU);
  write(fd,&zero,sizeof(int));
  ptr = mmap(NULL,sizeof(int),PROT_READ |PROT_WRITE,MAP_SHARED,fd,0);
  close(fd);

  if( sem_init(&mutex,1,1) < 0)
    {
      perror("semaphore initilization");
      exit(0);
    }
  if (fork() == 0) {
    for (i = 0; i < nloop; i++) {
      sem_wait(&mutex);
      printf("child entered crititical section: %d\n", (*ptr)++);
      sleep(2);
      printf("child leaving critical section\n");
      sem_post(&mutex);
      sleep(1);
    }
    exit(0);
  }
  for (i = 0; i < nloop; i++) {
    sem_wait(&mutex);
    printf("parent entered critical section: %d\n", (*ptr)++);
    sleep(2);
    printf("parent leaving critical section\n");
    sem_post(&mutex);
    sleep(1);
  }
  exit(0);
}

Pengertian IPC dan macam-macam IPC

IPC adalah singkatan dari Inter Process Communicationatau komunikasi antar proses

Pengertian dari IPC itu sendiri adalah suatu mekanisme pertukaran data antar satu proses dengan proses lainnya, baik itu yang terjadi didalam satu komputer yang sama maupun yang terjadi antara komputer yang terhubung dengan jaringan

Adapun Jenis-Jenis IPC ada 5 metode yaitu:

1.Shared Memory

2. Pipes

3. Semaphore

4. Message Queue

5.Socket


Saturday, October 4, 2014

Perintah-Perintah Dasar Linux beserta fungsinya

- ls: Menampilkan isi dari suatu direktori. Perintah ini bisa berdiri sendiri
ataupun dijalankan dengan argument.

- dir: Memiliki fungsi yang sama dengan perintah ls, yaitu menampilkan
isi direktori.

- pwd (print working direktory):Menampilkan direktori yang sedang aktif (curent directory).

- mkdir: Perintah untuk membuat direktori.

- cd: Perintah untuk berpindah direktori aktif.

- rmdir: Perintah untuk menghapus direktori kosong.

-touch: Perintah untuk mengganti waktu pembuatan suatu file. Tetapi bila
file yang anda ketikkan belum ada maka secara otomatis file tersebut
akan dibuat. Anda bisa menentukan tipe file yang anda inginkan.

-more: Perintah ini bisa digunakan untuk menampilkan isi file teks dengan
tampilan perlayar.

-cp: Berfungsi untuk mengcopy atau menduplikat file dan direktori.

-mv: Perintah untuk memindahkan file dan direktori.

- rm: Untuk menghapus (remove) file atau direktori.

- find: Perintah untuk mencari suatu file dalam direktori tertentu.

- which: Perintah untuk menampilkan lokasi perintah dasar yang anda cari.

- tar: Perintah untuk mengextract (memekarkan) file.

-grep: Perintah untuk mencari karakter atau kata yang diinginkan dari sebuah
file yang terdiri dari banyak kalimat.

- uname: Perintah ini akan menampilkan informasi system komputer anda.

-date: Perintah untuk menampilkan tanggal dan waktu system.

- ps: Perintah untuk memberikan informasi status proses pada sistem kita. Menampilkan berbagai informasi mengenai proses apa saja yang sedang aktif, siapa pemilik proses tersebut, berapa lama proses berjalan dan berapa ID atau nomor pengenal proses.

Thursday, October 2, 2014

Pengertian Kernel dan Jenis-Jenis Kernel

Kernel adalah suatu perangkat lunak yang berfungsi sebagai perantara antara software dan hardware.

Kernel pada Sistem Operasi itu dibagi menjadi 3 yaitu:

  • Micro Kernel
Microkernel mengambil pendekatan dengan hanya mengelola yang terpentingnya saja ,
yakni : CPU, Memori, dan Inter Process Communication (IPC), Sedangkan yang lainnya hanya dilihat sebagai aksesoris dan diserahkan pada user mode

Kelebihannya  :
- Portabilitas = Kemampan sebuah program untuk berjalan pada lebih dari satu jenis sistem komputer tanpa modifikasi
- Kapasitas Hardisk yang kecil
- Kapasitas Memori yang kecil
- Keamanan

-Pemakaian Resource lebih efisien

Kekurangannya :
- Hardware harus bekerja melalui driver
- Hardware mungkin bereaksi lebih lambat karena driver dalam user mode
-  Proses harus menunggu dalam antrian untuk mendapatkan informasi

Contoh Sistem Operasi yang menggunakan Micro kernel:
GNU Hurd,Minix.


  • Monolitik Kernel
Monolitik Kernel Adalah kebalikan dari mikrokernel karena mereka tidak hanya mencakup CPU, Memori, dan ICP, tetapi mencakup hal-hal seperti driver device, manajemen file sistem, dan panggilan sistem server.

Kelebihannya :
- Program dapat langsung mengakses Hardware.
- Lebih mudah bagi pemrosesan untuk berkomunikasi satu sama lain.
- proses lebih cepat karena tidak ada antrian untuk waktu Prosesor.

Kekurangannya :
- Kapasitas Hardisk yang besar 
- Kapasitas Memori yang lebih besar
- Kurang aman karena semuanya berjalan dalam mode supervisor/pengamat.


Contoh Sistem Operasi yang menggunakan Monolitik Kernel:
Linux,Unix

  • Hybrid Kernel
Hybrid Kernel adalah Kernel yang menggabungkan kemampuan Micro Kernel dan Monolitik Kernel.Hybrid Kernel Memiliki kemampuan untuk memilih dan memilah apa yang ingin mereka jalankan, dalam user mode dan apa yang mereka jalankan dalam mode supervisor.
Kelebihannya :
- Kapasitas hardisk yang sedang
- Kapasitas memori yang sedang
- Lebih flexible dibandingkan mode lain 
Kekurangannya :
Proses harus menunggu dalam antrian untuk mendapatkan informasi
- Device Driver harus dikelola oleh pengguna.
Contoh Sistem Operasi yang menggunakan Hybrid Kernel:
Windows,Mac OS X

Tuesday, September 23, 2014

Sistem Operasi


  • Definisi Sistem Operasi
  1. Sistem Operasi adalah suatu program yang mengatur eksekusi program lain.
  2. Sistem Operasi adalah sebuah program yang berfungsi sebagai interface antar user dengan komputer.         

  • Fungsi Sistem Operasi
       Fungsi dari Sistem Operasi terbagi menjadi Tiga,Yaitu:

  1. Sebagai pengatur penggunaan perangkat keras oleh berbagai program Aplikasi serta para user.
  2. Sebagai pengawas penggunaan perangkat keras, Program aplikasi dan user (resource allocator).
  3. Sebagai pengendali yang bertujuan untuk Menghindari kekeliruan (error) dan penggunaan komputer yang tidak perlu.

  • Hal-hal yang harus ada di sebuah Sistem Operasi
  1. Kenyamanan (Membuat user komputer menjadi lebih nyaman dalam mengunakan komputer).
  2. Efisien (Penggunaan sumber dasa sistem komputer tepat tujuan "terarah dan terkendali").
  3. Evolusi (Sistem Operasi harus dibagun, sehingga memungkinkan dan memudahkan pengembangan, pengujian dan menciptakan sistem operasi baru yang lebih bagus lagi.

Layanan-layanan yang harus ada di sebuah Sistem Operasi

Layanan-layanan yang harus ada di sebuah Sistem Operasi adalah:

  • Program Development (Editor,Designer)
  • Program Execution (Scheduling Program)
  • Input/Output Devices Access
  • Controlled access to Files
  • System Access (Login User)
  • Error Detection & Response
  • System Accounting(Untuk Monitoring)

Sunday, March 23, 2014

Clixsense Auto Chain, get many free referrals!!!

HEY ClixSense USER!!! IF YOU REALLY WANT TO GET A MASSIVE AMOUNT OF REFERRALS FOR FREE JUST MAKE SURE YOU READ THE ENTIRE TEXT AND FOLLOW STEP BY STEP




Clixsense Auto Chain, get many free referrals!!!


Notice how each day increase profits
Start Earning Today!
Get many referrals for ClixSense FREE and start earning money.
With Clixsense Auto Chain you can get a good number of active referrals for Clixsense  totally FREE. All you need to invest is 5 minutes a day.
To understand the purpose of Clixsense Auto Chain is ​​necessary to know what is and how it works ClixSense. ClixSense is a PTC (Paid To Click) of the best known, it works you register (see the link below) and you see ads you log in, you pay $ 0.01 per ad viewed and $ 0.01 for each see ad your referrals, get more referrals few greater your benefits. All we know these systems know that to make money with these systems the most important thing is to have active referrals earnings but are rather discouraging poor continuing our referrals and getting to discourage ourselves. With Clixsense Auto Chain your referrals will be very active because they know they will get referrals turn active, inactive users most of these systems have not mentioned (maybe you're one of them). Would you become active if you saw that you referenced list grows and grows? But even though many of these systems for example Neobux earnings only give you referrals if you were active that day, that's the key to be active (and turn your referrals are active). It is important to have a good list of referrals and to be active, if you have referrals or not assets are likely to finish yourself becoming a more inactive.
For all that has been created Clixsense Auto Chain, by join Clixsense Auto Chain you will not only get a good number of FREE referrals,your referrals will also get a good number of referrals, and best of all, All these referrals through Clixsense Auto Chain be fully active because they will know for sure that they will get referrals and their referrals will also turn asset because it will get up to turn your referrals. Just follow the instructions and start making money with Clixsense.
How does Clixsense Auto Chain works?
Clixsense Auto Chain bases its operation on the system of duplication, duplication here for ClixSense links, add your link once to the system, and soon you promote your link will be duplicated many times automatically.
Who can participate in Clixsense Auto Chain?
All those who already belong to ClixSense and those who do not belong to ClixSense and thanks to the power of duplication Clixsense Auto Chain can know ClixSense and operation, adhering to Clixsense Auto Chain. To join Clixsense Auto Chain copy and save all the text of this letter in your notebook, or a blogger after adding your link published this letter in forums, free ads, emails etc. added your link with the title: " Clixsense Auto Chain, gets many referrals for free."
Difference between Clixsense Auto Chain and a conventional chain.
Conventional chains required for participation in, be referred to the chain in order to participate in it, even asking if you are registered in the program for which the chain has been created down you know of this program and losing the benefits have earned and then re-register in the program as mentioned in the chain.
Besides a conventional chain requires supervision of at least one person that while at first too fraught with problems, they increase as the chain grows, reaching a point where it is quite difficult for the supervisor to whom you are controlling the following referral, in addition to handling high traffic of mails, new users of the chain first ask the supervisor via email the link by which must in the string, then the supervisor should send the link to the payment schedule given to get referrals, the supervisor should monitor and save these links and then give them to new users of the chain. Some users go as far as to accuse these supervisors to give referrals to others when you touched them. Despite all this, these strings are really effective to get a limited number of referrals.
Clixsense Auto Chain With all this work is automatic, and does not need anyone's supervision and also avoids the kind of accusations typical of a conventional chain.
Nor is it necessary to join Clixsense Auto Chain unsubscribe from ClixSense and is perfectly compatible Clixsense Auto Chain join but also belong to any other chain ClixSense.
Since Clixsense Auto Chain bases its operation on the power of duplication, a greater number of participants got higher level of duplicity of our link, reaching more people than many of them may already be registered with ClixSense and many others not even ClixSense have heard, these are the people who will become your referrals cycle at the end of your link.
Remember Clixsense Auto Chain -operation is based on the duplication of LINKS not get referrals today, if you follow the rules- Clixsense Auto Chain may not receive referrals today or tomorrow either, so you'll be doing until you get referrals is that your link doubling leave until it's your turn to get your question, it is then that your referrals will rain down massively.


Follow Clixsense Auto Chain standars, do not try to cheat to get referrals tomorrow, you're hurting yourself and everyone. Probably get some referrals tomorrow if you cheat, but will be infinitely less than if you had waited your turn.


To join Clixsense Auto Chain follow these steps:
STEP 1. Copy everything full text Clixsense Auto Chain, do not change anything, to be effective Clixsense Auto Chain everyone should read the whole text, and save it to your notebook computer or computer. (Later you'll need it).


STEP 2. In the list you see below this paragraph just click on the link that is in the highest position in the list (if the link does not work copy the link and paste it in the address bar of your browser) and join ClixSense (if already ClixSense a member of this step is not necessary) once registered your link located at ClixSense for referring users.


SIGN IN ANY OF THESE LINKS SO YOU CAN BE PART OF THE CLIXSENSE AUTO CHAIN

Position  1.http://www.clixsense.com/?4086338
Position 2. http://www.clixsense.com/?4924848
Position 3. http://www.clixsense.com/?4740001
Positon 4. http://www.clixsense.com/?4878527
Position 5. http://www.clixsense.com/?3299436


STEP 3. Open your notebook with all the message and delete the link number 1, then passes the link number 2 to position 1, the link number 3 to number 2, the link number 4 to number 3, the link number 5 to number 4. thus the link that was when you saw Clixsense Auto Chain first in the number 1 position become vacant will be gone and ranked No. 5,  add your link to the position No 5. (Do not forget to add http:// before your link).


STEP 4. From here is where the real power of Auto Chain starts.
Start searching for online forums, bulletin boards, message boards, bulletin boards, chat sites (chats), discussions, discussion groups, online communities, everything that serves to spread the message and publishes Auto Chain the ALL AUTOCHAIN MESSAGE without changing anything except your link at number 5. Do not write it by hand, would spend hours writing, simply copy the contents of your scrapbook and paste to all these sites. Studies of this system are estimated to put 200 ads, my advice is to put more of these ads the first day and then put 1,2 or 3 each day, so your referrals continue to increase every day.
You can also send it to your contacts and friends, but do not spam, is annoying and it's a crime. Spam is considered send such messages to recipients whose e-mail has reached you in one way or another and do not even know you had requested information about it.
It is proved that for every 200 people who see this type of ad at least 15 are joined. These 15 new members will do the same as you doubling your link.


You send 200 listings come together 15 people.
1. 15 (1) = 15 people = Your link is duplicated 15 times.
2. 15 (15) = 225 people = Your link is duplicated 225 times.
3. 15 (225) = 3375 people = Your link is duplicated 3375 times.
4. 15 (3375) = 50625 people = Your link is duplicated 50,625 times.
5. 15 (50625) = 759375 people = Your link is duplicated 759,375 times.


Realistically you're not going to get to the end of your cycle 759,375 referrals, this is totally impossible, but suppose you get 100 referrals (a ridiculous figure watching the level of duplication of your links). Was it worth losing 5 minutes a day?
How can you win?
Assuming that we won those 100 referrals in a program and that the program will pay 0.01 cent per click or email and clicks or maximum daily emails are 4're winning:
$ 0.04 for your daily clicks.
$ 4 daily for the clicks of your referrals.
$ 0.04 x 30 days = $ 1.2
$ 4 x 30 days = $ 120
What makes a total of $ 121.2 monthly PTC or PTR, if you participate in several PTCS Autochains or Pars imagine how much you can earn per month for those 5 minutes a day. Even having achieved only 10 referrals for PTC and earn $ 12 per month for PTC or PTR and you will have been worthwhile to participate.
Welcome at Clixsense Auto Chain, start enjoying REFERRAL BENEFITS!
Simply the Best PTC World!