Think Essentially

計算機テクノロジー全般が好きです

Rust ランタイムについてまとめる

Rustのランタイムは、従来のガベージコレクション系の言語、Java, Goにおけるランタイムと意味合いが異なる。

概要

  • Rustランタイムは、標準ライブラリstdに組み込まれている
    • Rust言語のリポジトリにおけるsrc/libstd/rt.rsがそれに該当する
    • Rustのランタイム = ヒープ、バックトレース、巻き戻し、スタックガードなどを提供するもの
  • ユーザプログラムが実行される前に、src/libstd/rt.rsの初期化関数を呼び込む
fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize
  • 標準ライブラリなしでRustをコンパイルする場合、おおよそCのランタイムと等価

参考

https://prev.rust-lang.org/ja-JP/faq.html#does-rust-have-a-runtime github.com

プロセスとは

プロセスとは

  • プログラムの実行単位
  • メモリにロードされた実行中のプログラムの実体(インスタンス
  • 子プロセスとメモリを共有しない
  • 1つ以上のスレッドを持つ

プロセス管理

  • プロセスがCPUを独占することを防ぐ
    • CPU割り当て管理と言い換えてもよいかも
  • 一定時間で切替を行う
  • 3つの仕組み
    • プロセスの状態遷移
    • PCB: プロセスのデータ構造
    • CPU スケジューラー

参考文献

hogetech.info

d8 WebAssembly option

 --wasm-generic-wrapper (allow use of the generic js-to-wasm wrapper instead of per-signature wrappers)
        type: bool  default: --wasm-generic-wrapper
  --enable-wasm-arm64-generic-wrapper (allow use of the generic js-to-wasm wrapper instead of per-signature wrappers on arm64)
        type: bool  default: --enable-wasm-arm64-generic-wrapper
  --expose-wasm (expose wasm interface to JavaScript)
        type: bool  default: --expose-wasm
  --wasm-num-compilation-tasks (maximum number of parallel compilation tasks for wasm)
        type: int  default: --wasm-num-compilation-tasks=128
  --wasm-write-protect-code-memory (write protect code memory on the wasm native heap with mprotect)
        type: bool  default: --wasm-write-protect-code-memory
  --wasm-memory-protection-keys (protect wasm code memory with PKU if available (takes precedence over --wasm-write-protect-code-memory))
        type: bool  default: --wasm-memory-protection-keys
  --wasm-async-compilation (enable actual asynchronous compilation for WebAssembly.compile)
        type: bool  default: --wasm-async-compilation
  --wasm-test-streaming (use streaming compilation instead of async compilation for tests)
        type: bool  default: --no-wasm-test-streaming
  --wasm-native-module-cache-enabled (enable the native module cache)
        type: bool  default: --wasm-native-module-cache-enabled
  --wasm-max-mem-pages (maximum number of 64KiB memory pages per wasm memory)
        type: uint  default: --wasm-max-mem-pages=4294967295
  --wasm-max-table-size (maximum table size of a wasm instance)
        type: uint  default: --wasm-max-table-size=10000000
  --wasm-max-code-space (maximum committed code space for wasm (in MB))
        type: uint  default: --wasm-max-code-space=4095
  --wasm-tier-up (enable tier up to the optimizing compiler (requires --liftoff to have an effect))
        type: bool  default: --wasm-tier-up
  --wasm-dynamic-tiering (enable dynamic tier up to the optimizing compiler)
        type: bool  default: --wasm-dynamic-tiering
  --wasm-tiering-budget (budget for dynamic tiering (rough approximation of bytes executed)
        type: int  default: --wasm-tiering-budget=1800000
  --wasm-caching-threshold (the amount of wasm top tier code that triggers the next caching event)
        type: int  default: --wasm-caching-threshold=1000000
  --trace-wasm-compilation-times (print how long it took to compile each wasm function)
        type: bool  default: --no-trace-wasm-compilation-times
  --wasm-tier-up-filter (only tier-up function with this index)
        type: int  default: --wasm-tier-up-filter=-1
  --wasm-stack-switching-stack-size (default size of stacks for wasm stack-switching (in kB))
        type: int  default: --wasm-stack-switching-stack-size=984
  --liftoff (enable Liftoff, the baseline compiler for WebAssembly)
        type: bool  default: --liftoff
  --liftoff-only (disallow TurboFan compilation for WebAssembly (for testing))
        type: bool  default: --no-liftoff-only
  --trace-wasm-memory (print all memory updates performed in wasm code)
        type: bool  default: --no-trace-wasm-memory
  --wasm-tier-mask-for-testing (bitmask of functions to compile with TurboFan instead of Liftoff)
        type: int  default: --wasm-tier-mask-for-testing=0
  --wasm-debug-mask-for-testing (bitmask of functions to compile for debugging, only applies if the tier is Liftoff)

CLI Tailwind CSS セットアップ (v3.2.0)

0. 初めての場合

  • tailwindcssをnpm経由でインストール
npm i -D tailwindcss

1. configファイル雛形の作成

  • 2回目以降は次のコマンドから
npx tailwindcss init

2. configファイル雛形の作成

  • tailwind.config.jsのcontent を書き換える
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {},
  },
  plugins: [],
}
  • content プロパティは、./src以下の全てのディレクトリ内のhtml/jsファイルにおいてtailwindcssを適用しますよ、という設定を付与している

My TailwindCSS チートシート

padding

  • p-   : padding x, y軸
  • px- : padding x軸
  • py- : padding y軸

margin

  • m-   : margin x, y軸
  • mx- : margin x軸
  • my- : margin y軸

background

  • bg-$color- : background color
class="bg-blue-500"

flex

  • justify-between: justify-content: space-between;

align系

  • items-center: align-items: center;

ブレークポイントによって左右のmarginを自動調整したい

  • mx-auto

test

test

test