Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: native_client_sdk/src/doc/nacl-and-pnacl.rst

Issue 581643004: Copy edit Learn Basics section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from Patch Set 3 feedback. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 .. _nacl-and-pnacl: 1 .. _nacl-and-pnacl:
2 2
3 ############## 3 ##############
4 NaCl and PNaCl 4 NaCl and PNaCl
5 ############## 5 ##############
6 6
7 This document describes the differences between **Native Client** and 7 This document describes the differences between **Native Client** and
8 **Portable Native Client**, and provides recommendations for when to use each. 8 **Portable Native Client**, and provides recommendations for when to use each.
9 9
10 .. contents:: 10 .. contents::
11 :local: 11 :local:
12 :backlinks: none 12 :backlinks: none
13 :depth: 2 13 :depth: 2
14 14
15 .. _native-client-nacl:
16
15 Native Client (NaCl) 17 Native Client (NaCl)
16 ==================== 18 ====================
17 19
18 Native Client enables the execution of native code securely inside web 20 Native Client enables the execution of native code securely inside web
19 applications through the use of advanced `Software Fault Isolation (SFI) 21 applications through the use of advanced `Software Fault Isolation (SFI)
20 techniques <http://research.google.com/pubs/pub35649.html>`_. Since its launch in 22 techniques <http://research.google.com/pubs/pub35649.html>`_. Native Client
21 2011, Native Client has provided developers with the ability to harness a 23 allows you to harness a client machine's computational power to a fuller extent
22 client machine's computational power to a much fuller extent than traditional 24 than traditional web technologies. It does this by running compiled C and C++
23 web technologies, by running compiled C and C++ code at near-native speeds and 25 code at near-native speeds, and exposing a CPU's full capabilities, including
24 taking advantage of multiple cores with shared memory. 26 SIMD vectors and multiple-core processing with shared memory.
25 27
26 While Native Client provides operating system independence, it requires 28 While Native Client provides operating system independence, it requires you to
27 developers to generate architecture-specific executable 29 generate architecture-specific executables (**nexe**) for each hardware
28 (**nexe**) modules for each hardware platform. This is not only inconvenient 30 platform. This is neither portable nor convenient, making it ill-suited for the
29 for developers, but architecture-specific machine code is not portable and thus 31 open web.
30 not well-suited for the open web. The traditional method of application 32
31 distribution on the web is through a self-contained bundle of HTML, CSS, 33 The traditional method of application distribution on the web is through self-
32 JavaScript, and other resources (images, etc.) that can be hosted on a server 34 contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.)
33 and run inside a web browser. With this type of distribution, a website 35 that can be hosted on a server and run inside a web browser. With this type of
34 created today should still work years later, on all platforms. 36 distribution, a website created today should still work years later, on all
35 Architecture-specific executables are clearly not a good fit for distribution 37 platforms. Architecture-specific executables are clearly not a good fit for
36 on the web. As a consequence, Native Client has been restricted to 38 restricted to applications and browser extensions that are installed through the
37 applications and browser extensions that are installed through the 39 distribution on the web. Consequently, Native Client has been until recently
38 Chrome Web Store. 40 Chrome Web Store.
JF 2014/09/22 17:36:56 The line swap here seems like a bug.
jpmedley 2014/09/22 18:26:34 Done.
39 41
42 .. _portable-native-client-pnacl:
43
40 Portable Native Client (PNaCl) 44 Portable Native Client (PNaCl)
41 ============================== 45 ==============================
42 46
43 PNaCl solves the portability problem by splitting the compilation process 47 PNaCl solves the portability problem by splitting the compilation process
44 into two parts: 48 into two parts:
45 49
46 #. compiling the source code to a portable bitcode format, and 50 #. compiling the source code to a bitcode executable (pexe), and
47 #. translating the bitcode to a host-specific executable just before execution. 51 #. translating the bitcode to a host-specific executable as soon as the module
52 loads in the browser but before any code execution.
48 53
49 PNaCl enables developers to distribute **portable executables** (**pexe**) 54 This portability aligns Native Client with existing open web technologies such
50 modules that the hosting environment (in other words, the Chrome browser) can 55 as JavaScript. You can distribute a pexe as part of an application (along with
51 translate to native code before executing. This portability aligns Native Client 56 HTML, CSS, and JavaScript), and the user's machine is simply able to run it.
52 with existing open web technologies such as JavaScript. A developer can
53 distribute a **pexe** as part of an application (along with HTML, CSS, and
54 JavaScript), and the user's machine is simply able to run it.
55 57
56 With PNaCl, a developer generates a single **pexe** from source code, 58 With PNaCl, you'll generate a single pexe, rather than multiple platform-
57 rather than multiple platform-specific nexes. The **pexe** provides both 59 specific nexes. Since the pexe uses an abstract, architecture- and OS-
58 architecture- and OS-independence. Since the **pexe** uses an abstract, 60 independent format, it does not suffer from the portability problem described
59 architecture-independent format, it does not suffer from the portability 61 above. Although, PNaCl can be more efficient on some operating systems than on
60 problem described above. Future versions of hosting environments should 62 others. PNaCl boasts the same level of security as NaCl. Future versions of
61 have no problem executing the **pexe**, even on new architectures. 63 hosting environments should have no problem executing the pexe, even on new
62 Moreover, if an existing architecture is subsequently enhanced, the 64 architectures. Moreover, if an existing architecture is enhanced, the pexe
63 **pexe** doesn't even have to be recompiled. In some cases the 65 doesn't need to be recompiled. In some cases the client-side translation will
64 client-side translation will automatically be able to take advantage of 66 automatically take advantage of new capabilities. A pexe can be part of any web
65 the new capabilities. A **pexe** module can be part of any web 67 application. It does not have to be distributed through the Chrome Web Store. In
66 application. It does not have to be distributed through the Chrome Web 68 short, PNaCl combines the portability of existing web technologies with the
67 Store. In short, PNaCl combines the portability of existing web technologies 69 performance and security benefits of Native Client.
68 with the performance and security benefits of Native Client.
69 70
70 PNaCl is a new technology, and as such it still has a few limitations 71 PNaCl is a new technology, and as such it still has a few limitations
71 as compared to NaCl. These limitations are described below. 72 as compared to NaCl. These limitations are described below.
72 73
74 .. _when-to-use-pnacl:
75
73 When to use PNaCl 76 When to use PNaCl
74 ================= 77 =================
75 78
76 PNaCl is the preferred toolchain for Native Client, and the only way to deploy 79 PNaCl is the preferred toolchain for Native Client, and the only way to deploy
77 Native Client modules on the open web. Unless your project is subject to one 80 Native Client modules without the Google Web Store. Unless your project is
78 of the narrow limitations described below 81 subject to one of the narrow limitations described under ":ref:`When to use
79 (see :ref:`When to use NaCl<when-to-use-nacl>`), you should use PNaCl. 82 NaCl<when-to-use-nacl>`", you should use PNaCl.
80 83
81 Beginning with version 31, the Chrome browser supports translation of 84 Since version 31, Chrome supports translation of pexe
82 **pexe** modules and their use in web applications, without requiring 85 modules and their use in web applications without requiring installation either
83 any installation (either of a browser plugin or of the applications 86 of a browser plug-in or of the applications themselves. Native Client and PNaCl
84 themselves). Native Client and PNaCl are open-source technologies, and 87 are open-source technologies, and our hope is that they will be added to other
85 our hope is that they will be added to other hosting platforms in the 88 hosting platforms in the future.
86 future.
87 89
88 If controlled distribution through the Chrome Web Store is an important part 90 If controlled distribution through the Chrome Web Store is an important part of
89 of your product plan, the benefits of PNaCl are less critical for you. But 91 your product plan, the benefits of PNaCl are less critical for you. But you can
90 you can still use the PNaCl toolchain and distribute your application 92 still use the PNaCl toolchain and distribute your application through the Chrome
91 through the Chrome Web Store, and thereby take advantage of the 93 Web Store, and thereby take advantage of the conveniences of PNaCl, such as not
92 conveniences of PNaCl, such as not having to explicitly compile your application 94 having to explicitly compile your application for all supported architectures.
93 for all supported architectures.
94 95
95 .. _when-to-use-nacl: 96 .. _when-to-use-nacl:
96 97
97 When to use NaCl 98 When to use NaCl
98 ================ 99 ================
99 100
100 The limitations below apply to the current release of PNaCl. If any of 101 Use NaCl if any of the following apply to your application:
101 these limitations are critical for your application, you should use
102 non-portable NaCl:
103 102
104 * PNaCl does not support architecture-specific 103 * Your application requires architecture-specific instructions such as, for
105 instructions in an application (i.e., inline assembly), but tries to 104 example, inline assembly. PNaCl tries to offer high-performance portable
106 offer high-performance portable equivalents. One such example is 105 equivalents. One such example is PNaCl's :ref:`Portable SIMD Vectors
107 PNaCl's :ref:`Portable SIMD Vectors <portable_simd_vectors>`. 106 <portable_simd_vectors>`.
108 * PNaCl only supports static linking with the ``newlib`` 107 * Your application uses dynamic linking. PNaCl only supports static linking
109 C standard library (the Native Client SDK provides a PNaCl port of 108 with a PNaCl port of the ``newlib`` C standard library. Dynamic linking and
110 ``newlib``). Dynamic linking and ``glibc`` are not yet supported. 109 ``glibc`` are not yet supported in PNaCl. Work is under way to enable dynamic
111 Work is under way to enable dynamic linking in future versions of PNaCl. 110 linking in future versions of PNaCl.
112 * PNaCl does not support some GNU extensions 111 * Your application uses certain GNU extensions not supported by PNaCl's LLVM
113 like taking the address of a label for computed ``goto``, or nested 112 toolchain, like taking the address of a label for computed ``goto``, or nested
114 functions. 113 functions.
OLDNEW
« no previous file with comments | « native_client_sdk/src/doc/images/web-app-with-nacl.png ('k') | native_client_sdk/src/doc/overview.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698