Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

Access the power of bare-metal systems programming with Scala Native, an ahead-of-time Scala compiler. Without the baggage of legacy frameworks and virtual machines, Scala Native lets you re-imagine how your programs interact with your operating system. Compile Scala code down to native machine instructions; seamlessly invoke operating system APIs for low-level networking and IO; control pointers, arrays, and other memory management techniques for extreme performance; and enjoy instant start-up times. Skip the JVM and improve your code performance by getting close to the metal.

Developers generally build systems on top of the work of those who came before, accumulating layer upon layer of abstraction. Scala Native provides a rare opportunity to remove layers. Without the JVM, Scala Native uses POSIX and ANSI C APIs to build concise, expressive programs that run unusually close to bare metal. Scala Native compiles Scala code down to native machine instructions instead of JVM bytecode. It starts up fast, without the sluggish warm-up phase that's common for just-in-time compilers. Scala Native programs can seamlessly invoke operating system APIs for low-level networking and IO. And Scala Native lets you control pointers, arrays, and other memory layout types for extreme performance.

Write practical, bare-metal code with Scala Native, step by step. Understand the foundations of systems programming, including pointers, arrays, strings, and memory management. Use the UNIX socket API to write network client and server programs without the sort of frameworks higher-level languages rely on. Put all the pieces together to design and implement a modern, asynchronous microservice-style HTTP framework from scratch.

Take advantage of Scala Native's clean, modern syntax to write lean, high-performance code without the JVM.

What You Need:

A modern Windows, Mac OS, or Linux system capable of running Docker. All code examples in the book are designed to run on a portable Docker-based build environment that runs anywhere. If you don't have Docker yet, see the Appendix for instructions on how to get it.

1129108433
Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

Access the power of bare-metal systems programming with Scala Native, an ahead-of-time Scala compiler. Without the baggage of legacy frameworks and virtual machines, Scala Native lets you re-imagine how your programs interact with your operating system. Compile Scala code down to native machine instructions; seamlessly invoke operating system APIs for low-level networking and IO; control pointers, arrays, and other memory management techniques for extreme performance; and enjoy instant start-up times. Skip the JVM and improve your code performance by getting close to the metal.

Developers generally build systems on top of the work of those who came before, accumulating layer upon layer of abstraction. Scala Native provides a rare opportunity to remove layers. Without the JVM, Scala Native uses POSIX and ANSI C APIs to build concise, expressive programs that run unusually close to bare metal. Scala Native compiles Scala code down to native machine instructions instead of JVM bytecode. It starts up fast, without the sluggish warm-up phase that's common for just-in-time compilers. Scala Native programs can seamlessly invoke operating system APIs for low-level networking and IO. And Scala Native lets you control pointers, arrays, and other memory layout types for extreme performance.

Write practical, bare-metal code with Scala Native, step by step. Understand the foundations of systems programming, including pointers, arrays, strings, and memory management. Use the UNIX socket API to write network client and server programs without the sort of frameworks higher-level languages rely on. Put all the pieces together to design and implement a modern, asynchronous microservice-style HTTP framework from scratch.

Take advantage of Scala Native's clean, modern syntax to write lean, high-performance code without the JVM.

What You Need:

A modern Windows, Mac OS, or Linux system capable of running Docker. All code examples in the book are designed to run on a portable Docker-based build environment that runs anywhere. If you don't have Docker yet, see the Appendix for instructions on how to get it.

39.99 In Stock
Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

by Richard Whaling
Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

Modern Systems Programming with Scala Native: Write Lean, High-Performance Code without the JVM

by Richard Whaling

eBook

$39.99 

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Access the power of bare-metal systems programming with Scala Native, an ahead-of-time Scala compiler. Without the baggage of legacy frameworks and virtual machines, Scala Native lets you re-imagine how your programs interact with your operating system. Compile Scala code down to native machine instructions; seamlessly invoke operating system APIs for low-level networking and IO; control pointers, arrays, and other memory management techniques for extreme performance; and enjoy instant start-up times. Skip the JVM and improve your code performance by getting close to the metal.

Developers generally build systems on top of the work of those who came before, accumulating layer upon layer of abstraction. Scala Native provides a rare opportunity to remove layers. Without the JVM, Scala Native uses POSIX and ANSI C APIs to build concise, expressive programs that run unusually close to bare metal. Scala Native compiles Scala code down to native machine instructions instead of JVM bytecode. It starts up fast, without the sluggish warm-up phase that's common for just-in-time compilers. Scala Native programs can seamlessly invoke operating system APIs for low-level networking and IO. And Scala Native lets you control pointers, arrays, and other memory layout types for extreme performance.

Write practical, bare-metal code with Scala Native, step by step. Understand the foundations of systems programming, including pointers, arrays, strings, and memory management. Use the UNIX socket API to write network client and server programs without the sort of frameworks higher-level languages rely on. Put all the pieces together to design and implement a modern, asynchronous microservice-style HTTP framework from scratch.

Take advantage of Scala Native's clean, modern syntax to write lean, high-performance code without the JVM.

What You Need:

A modern Windows, Mac OS, or Linux system capable of running Docker. All code examples in the book are designed to run on a portable Docker-based build environment that runs anywhere. If you don't have Docker yet, see the Appendix for instructions on how to get it.


Product Details

ISBN-13: 9781680507492
Publisher: The Pragmatic Programmers
Publication date: 01/23/2020
Sold by: Barnes & Noble
Format: eBook
Pages: 260
File size: 2 MB

About the Author

Richard is a data engineering consultant at Spantree Technology Group in Chicago, where he designs large data pipelines using Scala-based technologies like Spark and Akka. He's made open-source contributions to Scala Native and Apache Kafka, and he blogs and speaks frequently about Scala and other functional programming topics.

Table of Contents

Acknowledgments ix

Foreword xi

Preface xiii

Systems Programming in the Twenty-First Century xix

Part I Foundations of Systems Programming

1 The Basics: Input and Output 3

Working with Output 3

Working with Input 10

Case Study: Google NGrams 18

What's Next 23

2 Arrays, Structs, and the Heap 25

The Stack and the Heap 25

Structs, Arrays, and Sorting 30

Sorting an Array 35

Aggregation at Scale 38

What's Next 43

3 Writing a Simple HTTP Client 45

Defining Terms 45

Working with TCP 48

Making a TCP Connection 53

Testing Network Code with Netcat 57

Introducing HTTP 58

Implementing HTTP 61

Testing Our Code 65

What's Next 67

4 Managing Processes: A Deconstructed Shell 69

Running a Program 70

Introducing exec 70

What Went Wrong? 73

Introducing Concurrency with fork() and wait() 73

Supervising Multiple Processes 77

Working with Pipes 79

What's Next 84

5 Writing a Server the Old-Fashioned Way 85

Understanding How a Server Works 85

Building Our Server 90

Creating a Minimum Viable Server 92

Handling HTTP 94

Performance Testing with Gatling 95

What's Next 99

Part II Modern Systems Programming

6 Doing I/O Right, with Event Loops 103

Blocking and Polling 103

Introducing libuv 105

Working with Asynchronous TCP Sockets 111

Building an Asynchronous HTTP Server 121

What's Next 129

7 Functions and Futures: Patterns for Distributed Services 131

Designing an Asynchronous API 131

Introducing Futures 132

Implementing Futures 134

Implementing an ExecutionContext 135

Futures and Promises 138

Introducing libcurl 139

Asynchronous curl 144

What's Next 153

8 Streaming with Pipes and Files 155

Looking at Streams, Files, and Descriptors 155

Streaming Pipe Input in libuv 156

Streaming File Input in libuv 161

Streaming File Output in libuv 164

Stream Processors 168

What's Next 174

9 Durability: An Embedded Key-Value Database with LMDB 177

Introducing Embedded Storage 178

Defining LMDB Concepts 178

Working with the LMDB API 180

Serialization and Deserialization with JSON 184

Putting LMDB on the Web 186

What's Next 189

10 Services: Encapsulation and Abstraction for Modern Designs 191

Services and Distributed Systems 191

Parsing, Revisited 193

Moving from Server to Service 198

Implementing an Idiomatic Service DSL 203

Integrations and Ecosystems 206

The Way Forward 209

A1 Setting Up the Environment 211

Running Scala Native on Mac OS 211

Why Use Containers? 212

Installing and Configuring Docker 213

Running Scala Native in Docker 214

Index 217

From the B&N Reads Blog

Customer Reviews