2021年4月14日 星期三

調整虛擬記憶體, 提升電腦效能


調整虛擬記憶體, 提升電腦效能

甚麼是虛擬記憶體:

虛擬記憶體 (Virtual Memory) 是電腦作業系統的一項應用技術,該技術會將磁碟 (Hard Disk) 的部分空間模擬成為實體記憶體 (RAM),使得在執行那些需要大量 RAM 的應用程式時,又或是同時執行多個應用程式時.電腦仍能運作如常, 不會因為實體記憶體不足而減慢運行, 或是當機.

虛擬記憶體之運作:

虛擬記憶體在磁碟內是以「交換(置換)檔」(swap file, page file) 存在,每次當電腦載入多個應用程式時, 如果這時所需的實實體記憶是超出實體記憶體之可用空間時,作業系統便會將一些在RAM上閒置已久的程式或是資料, 搬去硬碟上的虛擬記憶體, 讓出空間給正要載入之程式,  當有需時, 又再將這些程式或資料從硬碟 SWAP回來.

使用虛擬記憶體之優點:
  • 載入程式之可用空間變大 , 作業系統不再受制於實體記憶體之可用空間
  • 更多的程式可以同時運行,大大提升了電腦的效能。
  • 載入程式或是置換程式時, 所須的 I/O 次數減少,使得電腦的速度加快。
虛擬記憶體之設定:

Windows 系統是會自動幫我們設定了虛擬記憶體的大小, 但通常都是偏於保守. 如果我們想充分利用這項技術, 我們就得自己動手去設定. 設定時有幾項事情須要留意:
  • 虛擬記憶體的大小是以MB計算
  • 虛擬記憶體的大小可以是電腦上實體記憶體的 1.5 - 4 倍,例如電腦上裝了 4G RAM, 虛擬記憶體的大小便可以是 6144 MB (4 x 1024 x 1.5) 至到 16384 MB (4 x 1024 x 4)
  • Win 10 系統是有 2 個設定框以供調整:「起始大小 (MB)」及「最大值 (MB)」框, 例如我們可以填寫6144 , 16384; 或是其他個人喜歡的數值.
  • 如果將「起始大小」跟「最大值」設為同一數值, 例如 6144, 好處是虛擬記憶體會是在磁碟的連續區塊, 反之, 就會有浮動區,可能會這邊寫一點,那邊寫一點,位置不連續,磁頭跑來跑去,效能因此降低。
  • 當設定虛擬記憶體時, 我們還需要選擇設定在那裡. 建議不要設定在系統的磁碟區上, 因為系統肯定會經常到這裡讀寫系統檔、軟體檔等,如果再在這裡的虛擬記憶體進行 paging, 那麼記會產生搶讀搶寫, 降低了電腦的運作速度. 所以最好是設在不同的硬盆, 或是不同」分割區」.
  • 如果將虛擬記憶體設在 SSD 盆上, 速度是會更快, 因為 SSD 盆比硬盆快, 但是這又會縮短 SSD 盆的壽命.
  • 虛擬記憶體不足會造成系統多工運算錯誤

如何調整 WIN10 的虛擬記憶體設定:

  • 在搜尋欄, 輸入 "advance", 然後點選 "View advanced system setting"


  • 以下視窗 (System Properties) 就會出現, 在 'Performance' 欄內, click "Settings"


  • 跟著就會彈出以下視窗 (Performance Options)


  • 點擊 'Advanced' ----> 'Change...' , 便會得出下圖 (Virtual Memory)


  • 在上圖, 我選擇了 D (硬盤), 然後點選 'Custom size' 再在兩個空白欄內填上:12288 (我想設定的虛擬記憶體大小), 接著點 OK ----> OK ----> OK, 便大功告成
  • 重啟我的電腦, 我向 WIN 10 要求的虛擬記憶體大小便開始生效.












幾個好用的電視直播軟件

幾個好用的電視直播軟件


我很喜歡用安桌電視直播軟件欣賞體育直播節目,經常觀看的電視台不外乎是 CCTV5、CCTV5+ 、廣東體育、先烽乒羽等台。我發覺以下幾款直播軟件,無論在畫面的清𥇦度和0氾暢度都很不錯。


上表的數字代表的滿意度,5代表甚滿意,另外那些數目字則代台號:要輸入的數字才能轉到那個電視台。

我較常會使用的軟件是:

八爪魚 (li2ve_1.0.6_qt6) : http://www.qt6.com/dianshi/139401.html

 星火電視 : https://mega.nz/file/ljIlkQ6K#sJaqC5F_wTrdbQDFLlkg_4w00qBoRDzqvcsSvB6lpvQ


2021年3月18日 星期四

Dual Boot Linux Mint and WIN 10 with UEFI

 

Dual Boot Linux Mint and WIN 10 with UEFI

 

Installation Procedures:

  1. Start WIN 10 and use the Rufus application to create a WIN 10 bootable USB with GPT partion, and a Linux Mint bootable USB (with ow without GPT)

  2. Shut down WIN 10 and launch MX Linx from its live bootable USB. Use the Gparted application of MX Linux to format the (my) 240G SSD with GUID Partition Table (GPT)

  3. Restart the computer and use the bootable WIN 10 USB to start installing WIN 10 on the SSD. During installation process, assign 80G of free space for it. The Windows installer will at the same time automatically create three additional partitions on the disk: a 499MG (ntfs) partition for Windows’ hidden files, a 100MB (fat32) EFI system partition for storage of bootloaders or kernels, a 16 MB (unknown) partition called the Microsoft Reserved Partition (MSR) as shown below.

 

  1. Reboot the computer and continue to use the bootable USB to install Linux Mint. In this process, assign 80G of free space for the root (/) partion. While choosing where to install the Grub Boot Loader, select the Windows Boot Manager from the drop-down menu.


 

  1. After the installstion, reboot the computer. If the computer continues to boot to WIN 10 and without the Grub Menu, reboot the computer to its Bootup Menu screen ---> choose Boot ---> choose UEFI Hard Disk Drive BBS Priority, and from there change the first boot priority to linux mint (ubuntu). Then it should be OK.

2020年10月13日 星期二

UEFI and BIOS

UEFI and BIOS


UEFI stands for Unified Extensible Firmware Interface and BIOS stands for Basic Input/Output System.

Both UEFI and BIOS are low-level software that starts when you boot your PC before booting your operating system, but UEFI is a more modern solution, supporting larger hard drives, faster boot times, more security features, and—conveniently—graphics and mouse cursors.

How does a computer boot?

You press the power button on your laptop/desktop.

The CPU starts up, but needs some instructions to work on.

The firmware (UEFI or BIOS) launches a Power On Self Test (POST), initializes the hardware, detects the connected peripherals (mouse, keyboard, pendrive etc.) and checks if all connected devices are healthy. If successful, a 'beep' will be heard.

Finally, the firmware code cycles through all storage devices and looks for a boot-loader (usually located in first sector of a disk). If the boot-loader is found, then the firmware hands over control of the computer to it.

So now that the boot-loader is loaded, its job is to load the rest of the operating system. GRUB is one such boot-loader that is capable of loading unix-like operating systems and is also able to chain-load Windows OS. Boot-loader is only available in the first sector of a disk, which is 512 bytes. Given the complexity of modern operating systems, some of these boot-loaders tend to do multi-stage loading, where the main boot-loader loads the second-stage-boot-loader in an environment which is not restricted to 512 bytes.

The boot-loader then loads the kernel into memory. Linux operating systems will run the init process (the master process, from which other processes are forked/executed) and finally initialize the run-levels.

Whereas in Windows, wininit.exe is loaded along with some other processes like services.exe for service control, lsass.exe for local security and authority (similar to run-levels) and lsm.exe for local session management.

After all this, and after some other drivers are initialized, the Graphical User Inferface (GUI) will be loaded and you will be presented with the login screen.



BIOS is stored on an EPROM (Erasable Programmable Read-Only Memory), allowing the manufacturer to push out updates easily. It provides many helper functions that allow reading boot sectors of attached storage and printing things on screen. You can access BIOS during the initial phases of the boot procedure by pressing del, F2 or F10.

UEFI does the same job as a BIOS, but with one basic difference: it stores all data about initialization and startup in an .efi file, instead of storing it on the firmware. This .efi file is stored on a special partition called EFI System Partition (ESP) on the hard disk. This ESP partition also contains the bootloader.

UEFI was designed to overcome many limitations of the old BIOS, including:

UEFI supports drive sizes upto 9 zettabytes, whereas BIOS only supports 2.2 terabytes.

UEFI provides faster boot time.

UEFI has discrete driver support, while BIOS has drive support stored in its ROM, so updating BIOS firmware is a bit difficult.

UEFI offers security like "Secure Boot", which prevents the computer from booting from unauthorized/unsigned applications. This helps in preventing rootkits, but also hampers dual-booting, as it treats other OS as unsigned applications.

UEFI runs in 32bit or 64bit mode, whereas BIOS runs in 16bit mode. So UEFI is able to provide a GUI (navigation with mouse) as opposed to BIOS which allows navigation only using the keyboard.


You might not need UEFI

Though all modern computers come equipped with UEFI by default, some reasons why you might choose BIOS over UEFI are:

If you're beginner and don't care about messing with any type of firmware, BIOS is for you.

If you have < 2 TB per hard disk or partition, you can go with BIOS.

BIOS allows running multiple operating systems without changing any settings This can be a security issue from a modern standpoint, but hey, no hassles for the user.

BIOS provides system information to the operating system. So if your OS runs in 16 bit mode, it does not require writing code for interacting with hardware. It can directly use methods provided by BIOS. Else if the OS switches over to 32bit or 64bit mode, then it needs to provide its own subroutines for interacting with hardware.

If you are someone who prefers a keyboard and text based UI over navigation with a mouse and GUI, then BIOS is for you.


UEFI takes these limitations into account and provides a Legacy mode. In it you can run everything as if you had a BIOS firmware. But keep in mind that Intel has announced that it won't support traditional BIOS from 2020.

The traditional BIOS still has serious limitations. It can only boot from drives of 2.1 TB or less. 3 TB drives are now common, and a computer with a BIOS can’t boot from them. That limitation is due to the way the BIOS’s Master Boot Record system works.

The BIOS must run in 16-bit processor mode, and only has 1 MB of space to execute in. It has trouble initializing multiple hardware devices at once, which leads to a slower boot process when initializing all the hardware interfaces and devices on a modern PC.

The BIOS has needed replacement for a long time. Intel started work on the Extensible Firmware Interface (EFI) specification back in 1998. Apple chose EFI when it switched to the Intel architecture on its Macs in 2006, but other PC manufacturers didn’t follow. In 2007, Intel, AMD, Microsoft, and PC manufacturers agreed on a new Unified Extensible Firmware Interface (UEFI) specification. This is an industry-wide standard managed by the Unified Extended Firmware Interface Forum, and isn’t solely driven by Intel. UEFI support was introduced to Windows with Windows Vista Service Pack 1 and Windows 7. The vast majority of computers you can buy today now use UEFI rather than a traditional BIOS.


How UEFI Replaces and Improves on the BIOS

There’s no way to switch from BIOS to UEFI on an existing PC. You need to buy new hardware that supports and includes UEFI, as most new computers do. Most UEFI implementations provide BIOS emulation so you can choose to install and boot old operating systems that expect a BIOS instead of UEFI, so they’re backwards compatible.

This new standard avoids the limitations of the BIOS. The UEFI firmware can boot from drives of 2.2 TB or larger—in fact, the theoretical limit is 9.4 zettabytes. That’s roughly three times the estimated size of all the data on the Internet. That’s because UEFI uses the GPT partitioning scheme instead of MBR. It also boots in a more standardized way, launching EFI executables rather than running code from a drive’s master boot record.

UEFI can run in 32-bit or 64-bit mode and has more addressable address space than BIOS, which means your boot process is faster. It also means that UEFI setup screens can be slicker than BIOS settings screens, including graphics and mouse cursor support. However, this isn’t mandatory. Many PCs still ship with text-mode UEFI settings interfaces that look and work like an old BIOS setup screen.

UEFI is packed with other features. It supports Secure Boot, which means the operating system can be checked for validity to ensure no malware has tampered with the boot process. It can support networking features right in the UEFI firmware itself, which can aid in remote troubleshooting and configuration. With a traditional BIOS, you have to be sitting in front of a physical computer to configure it.

It’s not just a BIOS replacement, either. UEFI is essentially a tiny operating system that runs on top of the PC’s firmware, and it can do a lot more than a BIOS. It may be stored in flash memory on the motherboard, or it may be loaded from a hard drive or network share at boot.

Different PCs with UEFI will have different interfaces and features. It’s all up to your PC manufacturer, but the basics will be the same on each PC.


How to Access UEFI Settings on Modern PCs

If you’re a normal PC user, switching to a computer with UEFI won’t be a noticeable change. Your new computer will boot up and shut down faster than it would have with a BIOS, and you can use drives of 2.2 TB or more in size.

If you need to access low-level settings, there may be a slight difference. You may need to access the UEFI settings screen through the Windows boot options menu rather than pressing a key while your computer starts. With PCs now booting so quickly, PC manufacturers don’t want to slow down the boot process by waiting to see if you press a key. However, we’ve also seen PCs with UEFI that allow you to access the BIOS in the same way, by pressing a key during the boot-up process.

While UEFI is a big upgrade, it’s largely in the background. Most PC users will never notice—or need to care—that their new PCs use UEFI instead of a traditional BIOS. They’ll just work better and support more modern hardware and features.

2020年8月30日 星期日

How to Share Folders on Home Network in Manjaro Linux


How to Share Folders on Home Network in Manjaro Linux


My purpose of sharing files or folders over home network is to allow me to move away from the PC desk and watch any PC video files either on a tablet or on a TV. Sitting properly before a PC monitor to watch a large video file is sometimes quite tiresome and cannot be compared to the comfort of sitting on a sofa and watch it on a tablet or TV.

Previously, sharing a folder using Samba in Linux was quite troublesome, not as easy as that for Windows. But as time goes by and technique evolves, it is now just an easy job, particularly on Manjaro Linux with a Gnome desktop environment. The procedures are like these.

In the Gnome desktop of Manjaro, goto Settings and select Sharing. Turn on the sharing function by clicking the button at the top right corner.



To share a media folder, choose Media Sharing. You will see there are default shared folders: Music, Pictures and Videos. You may copy and paste your videos to these default shared folder, say Videos, then you can start watching. If you want to share files other than these, scroll down the menu until you see the Add(+) sign.


Clicking on the + sign, a window will pop up allowing you to browse through your computer to choose the folders that you want to share. If you want the folder, say, “Violin and Cello Sonata” to be shared, select it. After that, turn on the Wired connection 1 Button to enable the sharing process.
 

Done!

How to watch a video with a tablet (VLC Player)

Launch the VLC Player in an android device (say, Samsung Tablet), tab on the Menu icon (三)and choose Local Network


The following screen will appear


Choose kai’s media on kai-ms7a74, the following screen will appear


Choose Files & Folders, two shared folders appear


Open any of the folders, and click on any item (video) inside the folder, the video will be played on VLC as below



How to watch on a TV

To watch it on TV, I need a TV Box because my TV is not a smart one. Nowadays, TV Boxes are very chap on Taobao, with no more than a 100 bucks, you can get a quite good one:


On the TV Box, just install the VLC Player and follow the procedures as that a tablet above, then you can view the video clips your TV.

Note:

I have found that sharing folders other than the defaulted ones, Music, Pictures and Videos, is not a once and for all business. That is, if you share a folder this time, the next time you reboot your computer, you will not find your shared folder. A way to get around this, is to delete the shared folder and add it again to the shared list before watching it.

2020年8月15日 星期六

神級播放器 - MPV Player

 神級播放器 - MPV Player


MPV 是一个基于 MPlayer 和 mplayer2 的开源极简全能播放器。支持各种视频格式、音频解码、支持特效字幕(电影动漫的ass特效字幕都没啥问题),不仅支持本地播放,同样支持网络播放。重点是 MPV 具有多系统平台支持、命令行、自定义、GPU 解码、脚本支持等特点……

由于默认情况下,MPV 播放器简约到连 GUI 界面都没有提供,需要通过命令行或配置文件设置,因此它较少出现于大众媒体的视野,但它配置灵活、性能优秀,支持硬件解码,播放高清分辨率的 4K 视频也可以很流畅,轻巧且强大的特点一直使它成为玩软高手、技术爱好者们的挚爱。

甚至,得益于开源,基于 MPV 还衍生出来一大批第三方播放器,比如最近火热的 Mac 平台上的 IINA,以及 Baka MPlayer、bomi、mpc-qt、xt7-player-mpv 等,它们的“核心”其实就是 MPV。这恰恰说明 MPV 才是无数开发者和技术爱好者心目中的神器。

 OSC 界面操作說明

常用快捷鍵控制

減少/增加音量

9、0 (數字鍵盤區的不可用)

在音量符號上向前/向後旋轉鼠標滾軸

暫停、繼續播放

p, Space bar

上一個/下一個視頻(播放列表中)

< >, 在視頻中向前/向後旋轉鼠標滾軸

下一個視頻

Enter

靜音

m

截屏

s

進入/退出全屏

f

顯示視訊的詳情引數

i