Pages

Friday, March 30, 2012

Processor Governers & Disk I/O Schedulers in Android

I found the article from great kernel developer Neo3000 posted in forum.xda-developer.com, Samsung Galaxy SII thread.
I think is really useful for me and anyone who still confuse or dont know about "governors" processor in ARM architecture and I/O or disk schedulers in Android.
Hope this article reproduction is helpful.


Governors

1) Ondemand
2) Lulzactive (default)
3) Performance
4) Lagfree
5) Conservative
(module)
6) Lazy
(module)

7.)Lionheart (tweaked version of Conservative governers)

I/O Schedulers

1) BFQv3-R1 (Budget Fair Queuing) 2) Noop
3) SIO
4) VR (default)
5.) CFQ (complety Fair Queuing)
Governors Guide:
1) Ondemand
Default governor in almost all stock kernels. Simply put, Ondemand jumps to maximum frequency on CPU load and decreases the frequency step by step on CPU idle. No suspend/wake profiles. Even though many of us consider this a reliable governor, it falls short on battery saving and performance on default settings.

2) Lulzactive
This new find from Tegrak is based on interactive & smartass governors and is one of our favorites.
Old Version: When workload is greater than or equal to 60%, the governor scales up cpu to next higher step. When workload is less than 60%, governor scales down cpu to next lower step. When screen is off, frequency is locked to global scaling minimum frequency.
New Version: Three more user configurable parameters: inc_cpu_load, pump_up_step, pump_down_step. Unlike older version, this one gives more control for the user. We can set the threshold at which governor decides to scale up/down. We can also set number of frequency steps to be skipped while polling up and down.
When workload greater than or equal to inc_cpu_load, governor scales CPU pump_up_step steps up. When workload is less than inc_cpu_load, governor scales CPU down pump_down_step steps down.
Example:
Consider
inc_cpu_load=70
pump_up_step=2
pump_down_step=1
If current frequency=200, Every up_sampling_time Us if cpu load >= 70%, cpu is scaled up 2 steps - to 800.
If current frequency =1200, Every down_sampling_time Us if cpu load < 70%, cpu is scaled down 1 step - to 1000.

3) Performance
Sets min frequency as max frequency. Use this while benchmarking!

4) Lagfree
Lagfree is similar to ondemand. Main difference is it's optimization to become more battery friendly. Frequency is gracefully decreased and increased, unlike ondemand which jumps to 100% too often. Lagfree does not skip any frequency step while scaling up or down. Remember that if there's a requirement for sudden burst of power, lagfree can not satisfy that since it has to raise cpu through each higher frequency step from current. Some users report that video playback using lagfree stutters a little.

5) Conservative
A slower ondemand which scales up slowly to save battery. Simply put, this governor increases the frequency step by step on CPU load and jumps to lowest frequency on CPU idle.

6) Lazy
This governor from Ezekeel is basically an ondemand with an additional parameter min_time_state to specify the minimum time cpu stays on a frequency before scaling up/down. The Idea here is to eliminate any instabilities caused by fast frequency switching by ondemand. Lazy governor polls more often than ondemand, but changes frequency only after completing min_time_state on a step. Lazy also has a screenoff_maxfreq parameter which can be configured to specify screen-off max frequency.

I/O Schedulers Guide:
Q. "What purposes does an i/o scheduler serve?"
A.
  1. Minimize hard disk seek latency.
  2. Prioritize I/O requests from processes.
  3. Allocate disk bandwidth for running processes.
  4. Guarantee that certain requests will be served before a deadline.

So in the simplest of simplest form: Kernel controls the disk access using I/O Scheduler.

Q. "What goals every I/O scheduler tries to balance?"
A.
  1. Fairness (let every process have its share of the access to disk)
  2. Performance (try to serve requests close to current disk head position first, because seeking there is fastest)
  3. Real-time (guarantee that a request is serviced in a given time)

Q. "Description, advantages, disadvantages of each I/O Scheduler?"
A.

1) Noop

Inserts all the incoming I/O requests to a First In First Out queue and implements request merging. Best used with storage devices that does not depend on mechanical movement to access data (yes, like our flash drives). Advantage here is that flash drives does not require reordering of multiple I/O requests unlike in normal hard drives.

Advantages:
  • Serves I/O requests with least number of cpu cycles. (Battery friendly?)
  • Best for flash drives since there is no seeking penalty.
  • Good throughput on db systems.

Disadvantages:
  • Reduction in number of cpu cycles used is proportional to drop in performance.

2) BFQ
Instead of time slices allocation by CFQ, BFQ assigns budgets. Disk is granted to an active process until it's budget (number of sectors) expires. BFQ assigns high budgets to non-read tasks. Budget assigned to a process varies over time as a function of it's behavior.

Advantages:
  • Believed to be very good for usb data transfer rate.
  • Believed to be the best scheduler for HD video recording and video streaming (because of less jitter as compared to CFQ and others)
  • Considered an accurate i/o scheduler.
  • Achieves about 30% more throughput than CFQ on most workloads.
Disadvantages:
  • Not the best scheduler for benchmarking.
  • Higher budget assigned to a process can affect interactivity and increased latency.

3) SIO
Simple I/O scheduler aims to keep minimum overhead to achieve low latency to serve I/O requests. No priority quesues concepts, but only basic merging. Sio is a mix between noop & deadline. No reordering or sorting of requests.

Advantages:
  • Simple, so reliable.
  • Minimized starvation of requests.

Disadvantages:
  • Slow random-read speeds on flash drives, compared to other schedulers.
  • Sequential-read speeds on flash drives also not so good.

4) VR

Unlike other schedulers, synchronous and asynchronous requests are not treated separately, instead a deadline is imposed for fairness. The next request to be served is based on it's distance from last request.

Advantages:
  • May be best for benchmarking because at the peak of it's 'form' VR performs best.

Disadvantages:
  • Performance fluctuation results in below-average performance at times.
  • Least reliable/most unstable.


Just collecting notes and sharing..
Please let me know if there are wrong statements in this article or a copy-paste one without copyright stated.

Saturday, March 17, 2012

Doktrin Utama Kristen Protestan

Meskipun doktrin dari denominasi-denominasi Protestan jauh dari seragam, ada beberapa keyakinan yang tersebar pada Protestantisme yaitu doktrin sola gracia, sola fide, dan sola scriptura.
  • Sola gracia berpegang bahwa keselamatan merupakan anugerah dari Tuhan. Manusia tidak dapat menyelamatkan dirinya sendiri.
  • Sola fide berpegang bahwa keselamatan yang datang hanya melalui iman di dalam Yesus sebagai Kristus, bukan melalui perbuatan baik.
  • Sola scriptura mempertahankan bahwa Alkitab (bukan tradisi gereja atau interpretasi gerejawi dari Alkitab) adalah sumber otoritas final untuk semua orang Kristen.

Gereja-gereja Protestan umumnya menolak doktrin Katolik dan Ortodoks mengenai pewarisan apostolik dan pelayanan sakramental dari klerus. Kecuali yang ditemukan pada banyak negara, seperti di bagian selatan Eropa, yang berada di bawah pengaruh non-Katolik jauh sebelum Reformasi.
Pendeta Protestan dan pemimpin gereja memiliki peran dan otoritas yang sedikit berbeda di dalam komunitas mereka dibandingkan dengan pastor dan uskup pada Katolik, Anglikan dan Ortodoks.

Source: wikipedia

Just collecting notes & sharing.. Please let me know if there are wrong statements in this article or a copy-paste without stated copyright / source.

Saturday, March 10, 2012

Slice & Substring (JavaScript)

Okay, this time I put this article in English, because it's more straightforward than translating to Indonesian language.

slice() works like substring() with a few different behaviors.
Syntax: string.slice(start, stop);
Syntax: string.substring(start, stop);
 
Notes on substring():
  • If start equals stop, it returns an empty string.
  • If stop is omitted, it extracts characters to the end of the string.
  • If either argument is less than 0 or is NaN, it is treated as if it were 0.
  • If either argument is greater than the string's length, either argument will use the string's length.
  • If start > stop, then substring will swap those 2 arguments.
Notes on slice():
  • If stop is omitted, slice extracts chars to the end of the string, exactly like substring().
  • If start > stop, slice() will NOT swap the 2 arguments.
  • If start is negative, slice() will set char from the end of string, exactly like substr() in Firefox. This behavior is observed in both Firefox and IE.
  • If stop is negative, slice() will set stop to: (string.length – 1) – stop (original value).
For  .substr() and .slice(), they are notably different!

.slice() is:
string.slice(beginIndex, endIndex)

Whereas .substr() is:
string.substr(beginIndex, length);
 
So for example, if we have "1234" and wanted "23", it would be:
"1234".slice(1,3)
//or...
"1234".substr(1,2)
 
They also have different behavior for the more-rarely used negative indexes, look at the MDC documentation for .slice() and .substr() for full descriptions.

Source: StackOverflow

Sunday, March 4, 2012

Java Notes: Lenient


Class Hierarchy
 
java.lang.Object
  extended byjava.text.Format
      extended byjava.text.DateFormat

There is one method called : setLenient(boolean lenient)

setLenient() : is use to skip calculating date from undefined date but with correct format.

ex. 29/02/2001 doesn't throw an error but will change to 01/03/2001 if setLenient method to TRUE.
Remember there's no 29 february in 2001 years coz it is not a leap year (Syamsiah year).
But, if u don't wanna be like that, use setLenient method to FALSE

Sometimes, this small thing can trouble us if we implemented wrongly.

Just collecting notes and sharing..
Please let me know if there are wrong statements in this article or copy-paste one.

Wednesday, February 15, 2012

Tips Agar Tidak Mudah Lupa

Tadi kunci mobil diletakkan di mana ya? Tadi oven sudah dimatikan belum ya? Eh pintu rumah sudah dikunci belum?

Jika Anda biasa melontarkan beberapa pertanyaan di atas kepada diri sendiri, alias seorang pelupa, berikut ini 20 langkah memperbaiki daya ingat.

1. Padatkan
Ketika mengingat-ingat deretan huruf yang panjang seperti 33987643134509, pecahkanlah menjadi: 33 98 76 43 13 45 09.

2. Jangan menjejalkan
Lebih baik memberi ruang pada proses belajar. Contohnya, ketika Anda belajar bahasa asing, jangan mengulang satu kata terus-menerus. Demikian saran dr Chris Moulin dari Leeds Memory Group. Ulangi beberapa kali, dan kemudian lanjutkan lagi, dan kembali lagi nanti.

3. Ciptakan petunjuk
Jika kamu mempunyai kegiatan teratur setiap hari pada waktu tertentu, seperti minum obat, berilah petunjuk dirimu sendiri untuk menolong niatanmu tersebut. Misalnya: “Ketika acara TV ini selesai aku akan meminum obat.”

4. Gunakan gambar
Satu cara untuk mengingat sesuatu, seperti nama orang, adalah menggambarkan wajah mereka. Jadi ketika kamu bertemu Joe Diamond, bayangkan sebuah intan (diamond). Kamu harus lebih kreatif untuk menggambarkan nama orang dengan nama yang tidak biasa.

5. Buat lebih bermakna
Gunakan arti khusus untuk mewakili sebuah fakta atau angka, jika Anda perlu mengingat angka 50110662012, pikirkan jins Levi's, Perang Hastings, atau Olimpiade London.

6. Buatlah lebih pribadi
Buatlah sesuatu yang ingin kamu ingat berhubungan dengan dirimu sendiri. Itu pertolongan mengingat yang plaing baik. Contohnya Blair mulai berkuasa pada tahun 1997, kamu lulus tahun 1997.

7. Metode Kamar Roma
Metode Kamar Roma adalah tentang mengingat rangkaian informasi dengan memvisualisasikan mereka ke dalam sebuah lokasi. Gunakan tempat yang kamu tahu dengan baik, lakukan perjalanan pikiran melewati kamar dalam tatanan yang teratur. Kemudian letakkan informasi dari daftarmu satu per satu ke dalam setiap kamar.

Jadi ketika ingin mengingat Perdana Menteri, tempatkan Harold Wilson di lorong, James Callaghan di ruang keluarga, Margareth Thatcher di dapur dan seterusnya. Pikirkan itu pelan-pelan dan itu akan terus menempel.

8. Rutinitas
Rutinitas yang membosankan adalah teman terbaik ingatan. Letakkan barang-barang tersebut di tempat yang sama di waktu yang lama. Semakin terbiasa, semakin mudah Anda mengingat.

9. Menghafal
Menghafal adalah teknik pembelajaran yang menolong daya ingat - seperti 'Mejikuhibiniu' untuk mengingat warna pelangi. Gunakan frasa untuk mengingat hal, semakin aneh semakin baik.

10. Makan ikan berlendir
Minyak Omega-3 yang ada pada ikan berlendir, dapat membantu kekuatan Anda berkonsentrasi.

11. Konsumsi choline
Choline, asam amino yang ada pada telur, hati, ayam dan kedelai, dapat menjaga otak dan meningkatkan daya ingat. Penelitian terbaru menunjukkan, orang dengan konsumsi choline yang tinggi berhasil menyelesaikan tes daya ingat dengan lebih baik — walau diet kesehatan jangka panjang adalah kunci utama untuk menjaga fungsi otak yang baik, dengan sayuran hijau, buah beri, tomat, kacang dan kecambah adalah makanan yang baik untuk daya ingat.

12. Olahraga
Sebuah penelitian Cambridge University menyebutkan, latihan aerobik teratur seperti jogging dapat meningkatkan daya ingat dengan memicu pertumbuhan neuron baru di otak.

13. Mengajar
Mengajari konsep baru pada orang lain bisa membantu ingatanmu pada hal tersebut. Jadi berikan mata kuliah kecil untuk temanmu ketika kalian berdua belajar untuk tes yang sama.

14. Berpikiran positif
Menurut ahli kesehatan Harvard, stereotipe negatif tentang penuaan membuat daya ingat menurun. Jadi orang tua menghasilkan nilai yang tes daya ingat yang buruk ketika dihadapkan pada pernyataan pesimis tentang usia dan kekuatan otak — dan lebih baik ketika mendengar pesan untuk menjaga daya ingat tetap kuat hingga pensiun.

15. Gunakan seluruh inderamu
Makin banyak indera yang kamu gunakan ketika mengalami suatu kejadian, semakin mudah Anda mengingatnya nanti. Contoh, penciuman bisa secara cepat mengembalikan kenangan masa lalu. Jadi mulailah mengendus.

16. Catat
Gambar atau tulislah informasi yang ingin diingat.

17. Pengulangan
Ketika kamu ingin mengingat hal baru, ulangi dengan keras. Contohnya jika kamu baru diberitahu nama seseorang, panggil nama mereka ketika berbicara dengan orang tersebut.

18. Tantang dirimu sendiri
Beraktivitas memerlukan konsentrasi. Bergabunglah dengan klub membaca, teka-teki silang atau mencoba resep masakan baru. Kegiatan apapun yang menggunakan otak akan menolongmu untuk menjaga bakat hingga tua nanti.

19. Tulis, jangan ketik
Jari Anda mungkin akan kikuk menggunakan alat tulis ketika sudah terbiasa mengetik, namun menulis dengan tangan dapat membuat otak memproses informasi dengan lebih baik. Jadi ketika belajar hal yang baru, tulislah.

20. Meditasi
Penelitian AS menunjukkan, pengobatan harian mempertebal bagian otak cerebral cortex, yang bertanggungjawab membuat keputusan, perhatian dan daya ingat. Cobalah melakukan teknik mengosongkan pikiran, berfokus pada sebuah gambar, suara atau napas Anda sendiri.

Sumber: yahoo

Jika ada salah, mohon koreksinya :)
Maksud hati hanya mao sharing kok :D

Thursday, February 2, 2012

Guide of Deciding System Files on USB Flash Drives

FAT16, FAT32, NTFS, or exFAT on USB Flash Drives?
by stewie

If you don't feel like reading this boring guide and your thumb drive or partition is 2 GB* or smaller, then stick with the default FAT16 for best performance and cross-platform compatibility. There is a reason why most UFDs in these sizes, including my 4 GB stick, come pre-formatted with FAT16.

*Windows NT 4.0, 2000, XP, and Vista can support FAT16 up to 4 GB using 64K cluster size. However, it may create compatibility issues with some applications. But for storage purposes, it shouldn't cause any problems.
Quote:
Originally Posted by Anonymous
I just bought a USB thumb drive, which format should I use?
This question has been asked many times on NBR, many people are not sure about which one to use or suits their needs. In this guide, I will help you to understand the benefits and drawbacks for each of them.

Tools used for this guide:
  • 1 GB USB flash drive
  • Nodesoft Disk Bench (no synthetic results)

FAT16 (a.k.a. FAT)

Pros:
  • Highest cross-platform compatibility
  • Best overall performance
Cons:
  • 2 GB volume size limit or up to 4 GB with some OSs
  • Maximum file size of 4 GB (minus 1 byte)
  • No access control and permissions (could be a pro)

FAT32

Pros:
  • Good cross-platform compatibility
  • No 2 or 4 GB volume size limitation
Cons:
  • Moderate to slow overall performance
  • Maximum file size of 4 GB (minus 1 byte)
  • No access control and permissions (could be a pro)

NTFS

Pros:
  • No 2 or 4 GB volume size limitation
  • No 4 GB file size limitation
  • Very fast write speed for single file
  • Fewer disk accesses than FAT if a file is badly fragmented
  • Access control and permissions (could be a con)
Cons:
  • Low cross-platform compatibility
  • Slow write speed for multiple files
  • May have permission issues between users and systems
  • May decrease the lifespan of the UFD due to additional writes
  • Must remove the UFD with the "Safely Remove Hardware" procedure

exFAT (a.k.a. FAT64)

Pros:
  • No 2 or 4 GB volume size limitation
  • No 4 GB file size limitation
  • Fast write speed for single file
  • Requires less disk space overhead than NTFS
Cons:
  • Very slow write speed for multiple files
  • Cannot be used for Windows Vista's ReadyBoost capability
  • No access control and permissions (could be a pro)
  • Very low cross-platform compatibility
    (Currently only Windows Embedded CE 6.0, Vista SP1, Server 2008, and Windows 7. Drivers can be added to XP for read and write, but cannot format.)

Some test results with Nodesoft Disk Bench

Multiple tests were done for better accuracy, they were all done with the default allocation size, optimize for performance enabled, and antivirus disabled.

1 MB file | Read (MB/s) | Write (MB/s)

FAT16 — 32.393 — 2.063
FAT32 — 32.393 — 1.339
NTFS — 32.393 — 2.797
exFAT — 32.393 — 1.464

10 MB file | Read (MB/s) | Write (MB/s)

FAT16 — 129.334 — 4.645
FAT32 — 129.334 — 3.943
NTFS — 129.334 — 29.326
exFAT — 129.334 — 4.703

100 MB file | Read (MB/s) | Write (MB/s)

FAT16 — 306.212 — 5.106
FAT32 — 306.212 — 5.065
NTFS — 321.915 — 4.952
exFAT — 379.010 — 5.188

Writing 50 MB of 712 files and 95 folders

FAT16 — 1 min 12 sec
FAT32 — 1 min 19 sec
NTFS — 1 min 50 sec
exFAT — 1 min 55 sec


Conclusion

If you're reading/writing a single file, NTFS seems to win hands down. But in real life situations where multiple files being read and write, then it's another story, NTFS was more than half a minute slower when writing just 50 MB of multiple files and directories.

For some reason, the reading times from Disk Bench seem to be pretty much the same between the file systems, I'm not sure if they're accurate, but many other test results on the Internet (e.g. Irongeek.com, AnandTech.com) have shown that FAT16 to be the quickest as well, although the difference becomes less significant for bigger files. If you have done some tests with your UFD, please feel free to post them.

Source: http://forum.notebookreview.com/hardware-components-aftermarket-upgrades/332023-guide-fat16-fat32-ntfs-exfat-usb-flash-drives.html

Friday, January 27, 2012

SMS Tidak Terkirim Pada Blackberry

Dari tanggal 15-27 Januari 2012 saat tulisan ini dibuat, saya mengalami kesulitan dalam mengirim SMS di Blackberry saya.

Awal-awal bisa SMS tanpa masalah, tapi entah dari kapan SMS mulai susah dilakukan, bahkan telp pun susah. Asumsi awal saya adalah :
1. Sinyal yang buruk. Berhubung sinyal 3 sangat buruk di gedung kantor yang baru dan juga di lantai dasar rumah saya
Tapi setelah saya lihat, sinyal bar yang ada di BB saya ternyata full namun tetap tidak bisa mengirim SMS., Alhasil setelah mengecek ternyata pulsa yang habis (maklum kebanyakan komunikasi via BBM).
Setelah melakukan isi ulang ternyata juga masih ERROR! tidak bisa mengirim SMS.

Menurut pengalaman saya, yang pertama adalah SMS Center yang mungkin berubah. Berikut list SMS Center yang ada:

(1) Three [Hutchinson] : +6289644000001
(2)
Axis [Lippo Tel] : +628315000032
(3)
XL [Excelcomindo] : +62818445009
(4)
Simpati & Kartu As [Telkomsel] : +6281100000
(5)
Mentari [Indosat] : +62816124
(6)
IM3 [Indosat] : +62855000000

Namun setelah dilakukan pengecekan, SMS Center telah benar. Berarti penyebabnya adalah BB itu sendiri!
Setelah menelaah, ternyata kesalahan terdapat pada DATA CODING dan NETWORK TO SEND OVER, harus merujuk masing-masing ke "7 bit" dan "Circuit Switched" atau "Circuit Switched Preferred".
Option tsb bisa dilihat di  Messages - logo bb - option.

Semoga info ini membantu.
Maksud hati hanya mao sharing yang saya tau kok dan mendokumentasikannya :D