6. The domain of the function $y=\sin x$ is $[a, b]$, and the range is $\left[-1, \frac{1}{2}\right]$. Then the maximum value of $b-a$ is ( ).
(A) $\pi$
(B) $2 \pi$
(C) $\frac{4 \pi}{3}$
(D) $\frac{5 \pi}{3}$
6.C.

As shown in Figure 2.
To make the function $y=\sin x$ have a range of $\left[-1, \frac{1}{2}\right]$ on the domain $[a, b]$, the maximum value of $b-a$ is $\frac{\pi}{6}-\left(-\frac{7 \pi}{6}\right)=\frac{4 \pi}{3}$.