NaCl and PNaCl

Native Client (NaCl)

Native Client enables the execution of native code securely inside web applications through the use of advanced Software Fault Isolation (SFI) techniques. Native Client allows you to harness a client machine’s computational power to a fuller extent than traditional web technologies. It does this by running compiled C and C++ code at near-native speeds, and exposing a CPU’s full capabilities, including SIMD vectors and multiple-core processing with shared memory.

While Native Client provides operating system independence, it requires you to generate architecture-specific executables (nexe) for each hardware platform. This is neither portable nor convenient, making it ill-suited for the open web.

The traditional method of application distribution on the web is through self- contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.) that can be hosted on a server and run inside a web browser. With this type of distribution, a website created today should still work years later, on all platforms. Architecture-specific executables are clearly not a good fit for distribution on the web. Consequently, Native Client has been until recently restricted to applications and browser extensions that are installed through the Chrome Web Store.

Portable Native Client (PNaCl)

PNaCl solves the portability problem by splitting the compilation process into two parts:

  1. compiling the source code to a bitcode executable (pexe), and
  2. translating the bitcode to a host-specific executable as soon as the module loads in the browser but before any code execution.

This portability aligns Native Client with existing open web technologies such as JavaScript. You can distribute a pexe as part of an application (along with HTML, CSS, and JavaScript), and the user’s machine is simply able to run it.

With PNaCl, you’ll generate a single pexe, rather than multiple platform- specific nexes. Since the pexe uses an abstract, architecture- and OS- independent format, it does not suffer from the portability problem described above. Although, PNaCl can be more efficient on some operating systems than on others. PNaCl boasts the same level of security as NaCl. Future versions of hosting environments should have no problem executing the pexe, even on new architectures. Moreover, if an existing architecture is enhanced, the pexe doesn’t need to be recompiled. In some cases the client-side translation will automatically take advantage of new capabilities. A pexe can be part of any web application. It does not have to be distributed through the Chrome Web Store. In short, PNaCl combines the portability of existing web technologies with the performance and security benefits of Native Client.

PNaCl is a new technology, and as such it still has a few limitations as compared to NaCl. These limitations are described below.

When to use PNaCl

PNaCl is the preferred toolchain for Native Client, and the only way to deploy Native Client modules without the Google Web Store. Unless your project is subject to one of the narrow limitations described under “When to use NaCl”, you should use PNaCl.

Chrome supports translation of pexe modules and their use in web applications without requiring installation either of a browser plug-in or of the applications themselves. Native Client and PNaCl are open-source technologies, and our hope is that they will be added to other hosting platforms in the future.

If controlled distribution through the Chrome Web Store is an important part of your product plan, the benefits of PNaCl are less critical for you. But you can still use the PNaCl toolchain and distribute your application through the Chrome Web Store, and thereby take advantage of the conveniences of PNaCl, such as not having to explicitly compile your application for all supported architectures.

When to use NaCl

Use NaCl if any of the following apply to your application:

  • Your application requires architecture-specific instructions such as, for example, inline assembly. PNaCl tries to offer high-performance portable equivalents. One such example is PNaCl’s Portable SIMD Vectors.
  • Your application uses dynamic linking. PNaCl only supports static linking with a PNaCl port of the newlib C standard library. Dynamic linking and glibc are not yet supported in PNaCl. Work is under way to enable dynamic linking in future versions of PNaCl.
  • Your application uses certain GNU extensions not supported by PNaCl’s LLVM toolchain, like taking the address of a label for computed goto, or nested functions.
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末朝捆,一起剝皮案震驚了整個(gè)濱河市贼穆,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌油啤,老刑警劉巖云石,帶你破解...
    沈念sama閱讀 217,509評(píng)論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡讯蒲,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,806評(píng)論 3 394
  • 文/潘曉璐 我一進(jìn)店門肄扎,熙熙樓的掌柜王于貴愁眉苦臉地迎上來墨林,“玉大人,你說我怎么就攤上這事犯祠⌒竦龋” “怎么了?”我有些...
    開封第一講書人閱讀 163,875評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵衡载,是天一觀的道長搔耕。 經(jīng)常有香客問我,道長痰娱,這世上最難降的妖魔是什么弃榨? 我笑而不...
    開封第一講書人閱讀 58,441評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮梨睁,結(jié)果婚禮上鲸睛,老公的妹妹穿的比我還像新娘。我一直安慰自己坡贺,他們只是感情好腊凶,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,488評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著拴念,像睡著了一般钧萍。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上政鼠,一...
    開封第一講書人閱讀 51,365評(píng)論 1 302
  • 那天风瘦,我揣著相機(jī)與錄音,去河邊找鬼公般。 笑死万搔,一個(gè)胖子當(dāng)著我的面吹牛胡桨,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播瞬雹,決...
    沈念sama閱讀 40,190評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼昧谊,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了酗捌?” 一聲冷哼從身側(cè)響起呢诬,我...
    開封第一講書人閱讀 39,062評(píng)論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎胖缤,沒想到半個(gè)月后尚镰,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,500評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡哪廓,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,706評(píng)論 3 335
  • 正文 我和宋清朗相戀三年狗唉,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片涡真。...
    茶點(diǎn)故事閱讀 39,834評(píng)論 1 347
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡分俯,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出哆料,到底是詐尸還是另有隱情缸剪,我是刑警寧澤,帶...
    沈念sama閱讀 35,559評(píng)論 5 345
  • 正文 年R本政府宣布剧劝,位于F島的核電站橄登,受9級(jí)特大地震影響抓歼,放射性物質(zhì)發(fā)生泄漏讥此。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,167評(píng)論 3 328
  • 文/蒙蒙 一谣妻、第九天 我趴在偏房一處隱蔽的房頂上張望萄喳。 院中可真熱鬧,春花似錦蹋半、人聲如沸他巨。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,779評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽染突。三九已至,卻和暖如春辈灼,著一層夾襖步出監(jiān)牢的瞬間份企,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,912評(píng)論 1 269
  • 我被黑心中介騙來泰國打工巡莹, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留司志,地道東北人甜紫。 一個(gè)月前我還...
    沈念sama閱讀 47,958評(píng)論 2 370
  • 正文 我出身青樓,卻偏偏與公主長得像骂远,于是被迫代替她去往敵國和親囚霸。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,779評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,325評(píng)論 0 10
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,471評(píng)論 5 6
  • 這是出生社會(huì)第一次在平臺(tái)寫下自己的故事或者感想吨述,我也不知道有沒有人能夠和我一起分享。 是的钞脂,我準(zhǔn)備結(jié)婚了揣云。對于一個(gè)...
    媽媽叫我小哪吒閱讀 292評(píng)論 0 0
  • 穿這樣去找我妹妹洗澡和吃飯 一路上回頭率挺高 我妹妹看到笑趴下了 說她這個(gè)主任的臉被我丟完了 還有那件讓我媽氣到發(fā)...
    毛欣與小李閱讀 139評(píng)論 0 0
  • 這是第幾次和兒子因?yàn)橥悊栴}發(fā)生爭執(zhí)?我也不是記得很清楚冰啃!當(dāng)時(shí)邓夕,我和兒子情緒都很激動(dòng),互不相讓阎毅!兒子就像是個(gè)...
    自然就好22閱讀 471評(píng)論 0 2